fix potential NULL dereferences found by coverity

This commit is contained in:
Max Bruckner
2017-02-08 03:00:44 +01:00
parent 49b9336558
commit 4047de4f6e
2 changed files with 6 additions and 1 deletions

View File

@ -167,6 +167,11 @@ static const unsigned char *parse_number(cJSON *item, const unsigned char *num)
double number = 0;
unsigned char *endpointer = NULL;
if (num == NULL)
{
return NULL;
}
number = strtod((const char*)num, (char**)&endpointer);
if ((num == endpointer) || (num == NULL))
{