File tree 1 file changed +16
-3
lines changed
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) {
317
317
document_ += valueToString (value.asDouble ());
318
318
break ;
319
319
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));
321
326
break ;
327
+ }
322
328
case booleanValue:
323
329
document_ += valueToString (value.asBool ());
324
330
break ;
@@ -382,7 +388,7 @@ void StyledWriter::writeValue(const Value& value) {
382
388
break ;
383
389
case stringValue:
384
390
{
385
- // Is NULL is possible for value.string_?
391
+ // Is NULL possible for value.string_?
386
392
char const * str;
387
393
char const * end;
388
394
bool ok = value.getString (&str, &end);
@@ -599,8 +605,15 @@ void StyledStreamWriter::writeValue(const Value& value) {
599
605
pushValue (valueToString (value.asDouble ()));
600
606
break ;
601
607
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 (" " );
603
615
break ;
616
+ }
604
617
case booleanValue:
605
618
pushValue (valueToString (value.asBool ()));
606
619
break ;
You can’t perform that action at this time.
0 commit comments