summaryrefslogtreecommitdiff
path: root/ext/json/ext/parser/parser.rl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/ext/parser/parser.rl')
-rw-r--r--ext/json/ext/parser/parser.rl4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl
index fba01ac..edab32b 100644
--- a/ext/json/ext/parser/parser.rl
+++ b/ext/json/ext/parser/parser.rl
@@ -554,7 +554,9 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
if (json->symbolize_names && json->parsing_name) {
*result = rb_str_intern(*result);
} else {
- rb_str_resize(*result, RSTRING_LEN(*result));
+ if (RB_TYPE_P(*result, T_STRING)) {
+ rb_str_resize(*result, RSTRING_LEN(*result));
+ }
}
if (cs >= JSON_string_first_final) {
return p + 1;