From c47a15b88af8d072dac2eb95ccbe2704a83a8e35 Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 12 Feb 2018 19:15:20 +0000 Subject: [PATCH] Check for existence of active when loading. --- src/entities/structures/cardReader.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/entities/structures/cardReader.c b/src/entities/structures/cardReader.c index 9d3d546..6068a0c 100644 --- a/src/entities/structures/cardReader.c +++ b/src/entities/structures/cardReader.c @@ -116,7 +116,10 @@ static void load(cJSON *root) s = (Structure*)self; - s->active = cJSON_GetObjectItem(root, "active")->valueint; + if (cJSON_GetObjectItem(root, "active")) + { + s->active = cJSON_GetObjectItem(root, "active")->valueint; + } STRNCPY(s->requiredItem, cJSON_GetObjectItem(root, "requiredCard")->valuestring, MAX_NAME_LENGTH); STRNCPY(s->targetNames, cJSON_GetObjectItem(root, "targetNames")->valuestring, MAX_DESCRIPTION_LENGTH); }