diff --git a/src/rapidjson/writer.h b/src/rapidjson/writer.h index 369e7e6ff0..a8eeab66d3 100644 --- a/src/rapidjson/writer.h +++ b/src/rapidjson/writer.h @@ -321,8 +321,8 @@ protected: } bool WriteDouble(double d) { - if (internal::Double(d).IsNanOrInf()) { - bool ret = true; + bool ret = true; + if (internal::Double(d).IsNanOrInf()) { if (!(writeFlags & kWriteNanAndInfFlag)) { // if we abort here, the writer is left in a broken state, unable to recover, so better write a 0 in addition to returning an error.