Fix: 'Stringify NaN, Inf as null'

The code path where 'null' is written was never reached when 'writeFlags == kWriteNanAndInfNullFlag'
This commit is contained in:
Jeroen Doggen 2023-09-20 11:25:18 +02:00 committed by Milo Yip
parent 476ffa2fd2
commit e7b6e5a208

View File

@ -349,7 +349,7 @@ protected:
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);