mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 14:57:16 +00:00
Fix invalid JSON
Fix invalid JSON floating point result from nan (Not a Number) and inf (Infinity) into null (#4147)
This commit is contained in:
parent
51ee22273b
commit
eefad54be7
@ -1,6 +1,6 @@
|
||||
/* 6.2.1.19 20181023
|
||||
* Fix header file execution order by renaming user_config.h to my_user_config.h
|
||||
* Fix invalid JSON floating point result from nan into null (#4147)
|
||||
* Fix invalid JSON floating point result from nan (Not a Number) and inf (Infinity) into null (#4147)
|
||||
*
|
||||
* 6.2.1.18 20181019
|
||||
* Add more API callbacks and document API.md
|
||||
|
@ -196,7 +196,7 @@ int TextToInt(char *str)
|
||||
|
||||
char* dtostrfd(double number, unsigned char prec, char *s)
|
||||
{
|
||||
if (isnan(number)) {
|
||||
if ((isnan(number)) || (isinf(number))) { // Fix for JSON output (https://stackoverflow.com/questions/1423081/json-left-out-infinity-and-nan-json-status-in-ecmascript)
|
||||
strcpy(s, "null");
|
||||
return s;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user