Skip to content

Commit

Permalink
Fix: 'Stringify NaN, Inf as null'
Browse files Browse the repository at this point in the history
The code path where 'null' is written was never reached when 'writeFlags == kWriteNanAndInfNullFlag'
  • Loading branch information
jeroendoggen authored and miloyip committed Sep 21, 2023
1 parent 476ffa2 commit e7b6e5a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/rapidjson/writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ class Writer {

bool WriteDouble(double d) {
if (internal::Double(d).IsNanOrInf()) {
if (!(writeFlags & kWriteNanAndInfFlag))
if (!(writeFlags & kWriteNanAndInfFlag) && !(writeFlags & kWriteNanAndInfNullFlag))
return false;
if (writeFlags & kWriteNanAndInfNullFlag) {
PutReserve(*os_, 4);
Expand Down

0 comments on commit e7b6e5a

Please sign in to comment.