mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-26 04:06:34 +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
|
/* 6.2.1.19 20181023
|
||||||
* Fix header file execution order by renaming user_config.h to my_user_config.h
|
* 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
|
* 6.2.1.18 20181019
|
||||||
* Add more API callbacks and document API.md
|
* 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)
|
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");
|
strcpy(s, "null");
|
||||||
return s;
|
return s;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user