Browse Source

Fix for JSON stringification of INF and NaN double values

tags/2021-05-28
jules 6 years ago
parent
commit
d5034083cb
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      modules/juce_core/javascript/juce_JSON.cpp

+ 6
- 1
modules/juce_core/javascript/juce_JSON.cpp View File

@@ -348,7 +348,12 @@ struct JSONFormatter
} }
else if (v.isDouble()) else if (v.isDouble())
{ {
out << String (static_cast<double> (v), maximumDecimalPlaces);
auto d = static_cast<double> (v);
if (juce_isfinite (d))
out << String (d, maximumDecimalPlaces);
else
out << "null";
} }
else if (v.isArray()) else if (v.isArray())
{ {


Loading…
Cancel
Save