[Groonga-commit] ranguba/rroonga at a33b57c [master] Add closed check to #encoding

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Mar 8 19:18:30 JST 2015


Kouhei Sutou	2015-03-08 19:18:30 +0900 (Sun, 08 Mar 2015)

  New Revision: a33b57c55832f31caadedbf83c27afc8b80a0d14
  https://github.com/ranguba/rroonga/commit/a33b57c55832f31caadedbf83c27afc8b80a0d14

  Message:
    Add closed check to #encoding
    
    GitHub: fix #54
    
    Reported by yui-knk. Thanks!!!

  Modified files:
    ext/groonga/rb-grn-encoding-support.c

  Modified: ext/groonga/rb-grn-encoding-support.c (+7 -1)
===================================================================
--- ext/groonga/rb-grn-encoding-support.c    2015-02-26 23:01:43 +0900 (17a45ab)
+++ ext/groonga/rb-grn-encoding-support.c    2015-03-08 19:18:30 +0900 (98c8d5e)
@@ -1,6 +1,6 @@
 /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
-  Copyright (C) 2009  Kouhei Sutou <kou �� clear-code.com>
+  Copyright (C) 2009-2015  Kouhei Sutou <kou �� clear-code.com>
 
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
@@ -44,6 +44,12 @@ rb_grn_encoding_support_get_encoding (VALUE self)
 
     rb_grn_object_deconstruct(SELF(self), &object, &context,
                               NULL, NULL, NULL, NULL);
+    if (!object) {
+        rb_raise(rb_eGrnClosed,
+                 "can't access already closed Groonga object: <%s>",
+                 rb_grn_inspect(self));
+    }
+
     encoding_value = grn_obj_get_info(context, object, GRN_INFO_ENCODING, NULL);
     rb_grn_context_check(context, self);
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index