[Groonga-commit] groonga/groonga at 277484c [master] mrb: Context#[] accepts nil

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Feb 23 18:11:46 JST 2015


Kouhei Sutou	2015-02-23 18:11:46 +0900 (Mon, 23 Feb 2015)

  New Revision: 277484c1feb2305961521f21a0841e5beb58f6a0
  https://github.com/groonga/groonga/commit/277484c1feb2305961521f21a0841e5beb58f6a0

  Message:
    mrb: Context#[] accepts nil
    
    nil is returned for nil input.

  Modified files:
    lib/mrb/mrb_ctx.c

  Modified: lib/mrb/mrb_ctx.c (+4 -0)
===================================================================
--- lib/mrb/mrb_ctx.c    2015-02-23 17:52:24 +0900 (f52342a)
+++ lib/mrb/mrb_ctx.c    2015-02-23 18:11:46 +0900 (ed0c8f6)
@@ -58,6 +58,10 @@ ctx_array_reference(mrb_state *mrb, mrb_value self)
 
   mrb_get_args(mrb, "o", &mrb_id_or_name);
 
+  if (mrb_nil_p(mrb_id_or_name)) {
+    return mrb_nil_value();
+  }
+
   if (mrb_fixnum_p(mrb_id_or_name)) {
     grn_id id = mrb_fixnum(mrb_id_or_name);
     object = grn_ctx_at(ctx, id);
-------------- next part --------------
HTML����������������������������...
Télécharger 



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