aboutsummaryrefslogtreecommitdiff
path: root/redist/json_helpers.c
diff options
context:
space:
mode:
authorMike Turvey <mturvey6@gmail.com>2017-03-11 09:00:58 -0700
committerMike Turvey <mturvey6@gmail.com>2017-03-11 09:00:58 -0700
commitba38ddcc4c3d74c00139ceff9b45481259d80fc7 (patch)
treeba1efc8aa8f7a76aa9f9f831aff16ea86fdc2b23 /redist/json_helpers.c
parent1d9db12d7e115f2b8994f014e37f1086c17e90fd (diff)
parentcdc60d110a9cd69c5bd8c0ac4e67db1ce7cecc93 (diff)
downloadlibsurvive-ba38ddcc4c3d74c00139ceff9b45481259d80fc7.tar.gz
libsurvive-ba38ddcc4c3d74c00139ceff9b45481259d80fc7.tar.bz2
Merge remote-tracking branch 'remotes/upstream/master' into Octavios_Algorithm
Conflicts: redist/linmath.c
Diffstat (limited to 'redist/json_helpers.c')
-rw-r--r--redist/json_helpers.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/redist/json_helpers.c b/redist/json_helpers.c
index b7ccb40..4a3ba55 100644
--- a/redist/json_helpers.c
+++ b/redist/json_helpers.c
@@ -76,6 +76,7 @@ uint32_t JSON_STRING_LEN;
char* load_file_to_mem(const char* path) {
FILE * f = fopen( path, "r" );
+ if (f==NULL) return NULL;
fseek( f, 0, SEEK_END );
int len = ftell( f );
fseek( f, 0, SEEK_SET );
@@ -116,7 +117,10 @@ static uint16_t json_load_array(const char* JSON_STRING, jsmntok_t* tokens, uint
void json_load_file(const char* path) {
uint32_t i = 0;
+
char* JSON_STRING = load_file_to_mem(path);
+ if (JSON_STRING==NULL) return;
+
JSON_STRING_LEN = strlen(JSON_STRING);
jsmn_parser parser;