summaryrefslogtreecommitdiff
path: root/ext/json/parser/parser.rl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/parser/parser.rl')
-rw-r--r--ext/json/parser/parser.rl4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl
index fba01ac0e5d..edab32b78f6 100644
--- a/ext/json/parser/parser.rl
+++ b/ext/json/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;