File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -317,8 +317,14 @@ void FastWriter::writeValue(const Value& value) {
317317 document_ += valueToString (value.asDouble ());
318318 break ;
319319 case stringValue:
320- document_ += valueToQuotedString (value.asCString ());
320+ {
321+ // Is NULL possible for value.string_?
322+ char const * str;
323+ char const * end;
324+ bool ok = value.getString (&str, &end);
325+ if (ok) document_ += valueToQuotedStringN (str, static_cast <unsigned >(end-str));
321326 break ;
327+ }
322328 case booleanValue:
323329 document_ += valueToString (value.asBool ());
324330 break ;
@@ -382,7 +388,7 @@ void StyledWriter::writeValue(const Value& value) {
382388 break ;
383389 case stringValue:
384390 {
385- // Is NULL is possible for value.string_?
391+ // Is NULL possible for value.string_?
386392 char const * str;
387393 char const * end;
388394 bool ok = value.getString (&str, &end);
@@ -599,8 +605,15 @@ void StyledStreamWriter::writeValue(const Value& value) {
599605 pushValue (valueToString (value.asDouble ()));
600606 break ;
601607 case stringValue:
602- pushValue (valueToQuotedString (value.asCString ()));
608+ {
609+ // Is NULL possible for value.string_?
610+ char const * str;
611+ char const * end;
612+ bool ok = value.getString (&str, &end);
613+ if (ok) pushValue (valueToQuotedStringN (str, static_cast <unsigned >(end-str)));
614+ else pushValue (" " );
603615 break ;
616+ }
604617 case booleanValue:
605618 pushValue (valueToString (value.asBool ()));
606619 break ;
You can’t perform that action at this time.
0 commit comments