diff --git a/src/controller/controller.cpp b/src/controller/controller.cpp index 0b66fa99..59b05906 100644 --- a/src/controller/controller.cpp +++ b/src/controller/controller.cpp @@ -228,7 +228,7 @@ int main_loop(int argc, char ** argv){ if (Controller::conf.getOption("debug",true).size() > 1){ Controller::Storage["config"]["debug"] = Controller::conf.getInteger("debug"); } - if (Controller::Storage.isMember("config") && Controller::Storage["config"].isMember("debug")){ + if (Controller::Storage.isMember("config") && Controller::Storage["config"].isMember("debug") && Controller::Storage["config"]["debug"].isInt()){ Util::Config::printDebugLevel = Controller::Storage["config"]["debug"].asInt(); } //check for port, interface and username in arguments diff --git a/src/controller/controller_api.cpp b/src/controller/controller_api.cpp index ed602e96..44e86da8 100644 --- a/src/controller/controller_api.cpp +++ b/src/controller/controller_api.cpp @@ -242,8 +242,8 @@ void Controller::handleAPICommands(JSON::Value & Request, JSON::Value & Response JSON::Value & out = Controller::Storage["config"]; if (in.isMember("debug")){ out["debug"] = in["debug"]; - if (Util::Config::printDebugLevel != out["debug"].asInt()){ - Util::Config::printDebugLevel = out["debug"].asInt(); + if (Util::Config::printDebugLevel != (out["debug"].isInt()?out["debug"].asInt():DEBUG)){ + Util::Config::printDebugLevel = (out["debug"].isInt()?out["debug"].asInt():DEBUG); INFO_MSG("Debug level set to %u", Util::Config::printDebugLevel); } }