mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
[BugFix] ReadConfig not parse string "" as default path
This commit is contained in:
1 parent
6628b5bfd5
commit
ffd42c5e30
1 file changed
+7
-2
@@ -158,8 +158,13 @@ static int ReadConfig(const char* ConfigDir)
|
||||
const toml::Value* v = tbl.find(key);
|
||||
if (v && v->is<std::string>()) {
|
||||
std::string s = v->as<std::string>();
|
||||
strncpy(out, s.c_str(), INJECT_PATH_MAX - 1);
|
||||
PLOGD << "Found parameter: " << key << " = " << s.c_str();
|
||||
if (!s.empty()) {
|
||||
strncpy(out, s.c_str(), INJECT_PATH_MAX - 1);
|
||||
PLOGD << "Found parameter: " << key << " = " << s.c_str();
|
||||
} else {
|
||||
strncpy(out, def, INJECT_PATH_MAX - 1);
|
||||
PLOGD << "Parameter " << key << " is empty, use default: " << def;
|
||||
}
|
||||
} else {
|
||||
strncpy(out, def, INJECT_PATH_MAX - 1);
|
||||
PLOGD << "Not found parameter: " << key << ", use default: " << def;
|
||||
|
||||
Reference in new issue
Block a user