aboutsummaryrefslogtreecommitdiff
path: root/src/survive_config.c
diff options
context:
space:
mode:
authorMichael Turvey <mwturvey@users.noreply.github.com>2017-03-25 21:57:41 -0700
committerGitHub <noreply@github.com>2017-03-25 21:57:41 -0700
commitb795afd28b7f7e2c1b9ca3f01e9f5ffeb1c75be8 (patch)
treed7156b4742fa6a77c71c9deb46237c9b8ef1a670 /src/survive_config.c
parent5404526ae8da8c5fdff81b8ee8120ffe73647747 (diff)
parentefe1b3e98866d45dd3bb5f8060712db152762edd (diff)
downloadlibsurvive-b795afd28b7f7e2c1b9ca3f01e9f5ffeb1c75be8.tar.gz
libsurvive-b795afd28b7f7e2c1b9ca3f01e9f5ffeb1c75be8.tar.bz2
Merge pull request #43 from mwturvey/alternate_disambiguator
Alternate disambiguator
Diffstat (limited to 'src/survive_config.c')
-rw-r--r--src/survive_config.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/survive_config.c b/src/survive_config.c
index 0810280..005cfaf 100644
--- a/src/survive_config.c
+++ b/src/survive_config.c
@@ -175,7 +175,13 @@ const char* config_set_str(config_group *cg, const char *tag, const char* value)
if (cv == NULL) cv = next_unused_entry(cg);
sstrcpy(&(cv->tag), tag);
- sstrcpy(&(cv->data), value);
+
+ if (NULL != value){
+ sstrcpy(&(cv->data), value);
+ }
+ else {
+ sstrcpy(&(cv->data), "");
+ }
cv->type = CONFIG_STRING;
return value;
@@ -357,9 +363,11 @@ void handle_tag_value(char* tag, char** values, uint8_t count) {
print_json_value(tag,values,count);
config_group* cg = cg_stack[cg_stack_head];
+ if (NULL != *values){
if (parse_uint32(tag,values,count) > 0) return; //parse integers first, stricter rules
if (parse_floats(tag,values,count) > 0) return;
+ }
//should probably also handle string arrays
config_set_str(cg,tag,values[0]);