diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-08-02 13:59:03 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-08-02 13:59:03 -0700 |
commit | fdc708a624873da84409af4466e0d432e98253ac (patch) | |
tree | de12af5822cd678cfc04254b3a8917cc09df4bf8 | |
parent | 34364ab8ee5be36b975ea5fc141a31e3c508aae1 (diff) | |
download | infinitytier-fdc708a624873da84409af4466e0d432e98253ac.tar.gz infinitytier-fdc708a624873da84409af4466e0d432e98253ac.zip |
GitHub issue #979
-rw-r--r-- | service/OneService.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp index 40ffce2f..43f5d9c9 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -994,15 +994,17 @@ public: Mutex::Lock _l2(_localConfig_m); std::string lcbuf; if (OSUtils::readFile((_homePath + ZT_PATH_SEPARATOR_S "local.conf").c_str(),lcbuf)) { - try { - _localConfig = OSUtils::jsonParse(lcbuf); - if (!_localConfig.is_object()) { - fprintf(stderr,"ERROR: unable to parse local.conf (root element is not a JSON object)" ZT_EOL_S); + if (lcbuf.length() > 0) { + try { + _localConfig = OSUtils::jsonParse(lcbuf); + if (!_localConfig.is_object()) { + fprintf(stderr,"ERROR: unable to parse local.conf (root element is not a JSON object)" ZT_EOL_S); + exit(1); + } + } catch ( ... ) { + fprintf(stderr,"ERROR: unable to parse local.conf (invalid JSON)" ZT_EOL_S); exit(1); } - } catch ( ... ) { - fprintf(stderr,"ERROR: unable to parse local.conf (invalid JSON)" ZT_EOL_S); - exit(1); } } |