Fix crash on unknown commands (cf==nullptr)

This commit is contained in:
MichaelDvP
2021-07-22 19:35:27 +02:00
parent f2e0b193af
commit 6d94335079
4 changed files with 20 additions and 18 deletions

View File

@@ -186,14 +186,14 @@ void WebAPIService::parse(AsyncWebServerRequest * request, std::string & device_
delete response;
send_message_response(request, 400, "Command not found"); // Bad Request
return;
} else if (cmd_reply == CommandRet::ERROR) {
delete response;
send_message_response(request, 400, "Problems parsing elements"); // Bad Request
return;
} else if (cmd_reply == CommandRet::NOT_ALLOWED) {
delete response;
send_message_response(request, 401, "Bad credentials"); // Unauthorized
return;
} else if (cmd_reply != CommandRet::OK) {
delete response;
send_message_response(request, 400, "Problems parsing elements"); // Bad Request
return;
}
if (!json.size()) {