Browse files

better condition for mapping_populate_iter

  • Loading branch information...
1 parent 8c353c2 commit ee65e9414adbc2258298a37b92199ee5c9ed457f @qqshfox committed Mar 20, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 ext/rocketamf_ext/class_mapping.c
View
4 ext/rocketamf_ext/class_mapping.c
@@ -347,8 +347,8 @@ static int mapping_populate_iter(VALUE key, VALUE val, const VALUE args[2]) {
return ST_CONTINUE;
}
- if(TYPE(key) != T_SYMBOL && TYPE(key) != T_STRING) rb_raise(rb_eArgError, "Invalid type for property key: %s", rb_obj_classname(key));
- if(TYPE(key) == T_SYMBOL) key = rb_sym_to_s(key);
+ if(SYMBOL_P(key)) key = rb_sym_to_s(key);
+ else if(!RB_TYPE_P(key, T_STRING)) rb_raise(rb_eTypeError, "Invalid type for property key: %s", rb_obj_classname(key));
// Calculate symbol for setter function
ID setter_id;

0 comments on commit ee65e94

Please sign in to comment.