Browse files

rb_enc_get_index returns -1 for the encoding for non symbol immediates

  • Loading branch information...
1 parent 9781e96 commit f922d7bdc398fe8fa31d9322ef18e7592c3053d6 @dbussink dbussink committed Oct 11, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 vm/capi/encoding.cpp
View
2 vm/capi/encoding.cpp
@@ -143,6 +143,8 @@ extern "C" {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
Object* val = env->get_object(obj);
+ if(!val->reference_p() && !val->symbol_p()) return -1;
+
Encoding* enc = Encoding::get_object_encoding(env->state(), val);
if(enc->nil_p()) return 0;

0 comments on commit f922d7b

Please sign in to comment.