From d2fd24ecd7faad9a27f5237b42e861f294fa4a87 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 30 Dec 2019 15:32:20 +0100 Subject: [PATCH] HttpCommander: Build with more strict compiler settings --- httpcommander/devicepluginhttpcommander.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/httpcommander/devicepluginhttpcommander.cpp b/httpcommander/devicepluginhttpcommander.cpp index 962598ed..ba50b357 100644 --- a/httpcommander/devicepluginhttpcommander.cpp +++ b/httpcommander/devicepluginhttpcommander.cpp @@ -71,7 +71,7 @@ void DevicePluginHttpCommander::executeAction(DeviceActionInfo *info) QString method = action.param(httpRequestRequestActionMethodParamTypeId).value().toString(); QByteArray payload = action.param(httpRequestRequestActionBodyParamTypeId).value().toByteArray(); - QNetworkReply *reply; + QNetworkReply *reply = nullptr; if (method == "GET") { reply = hardwareManager()->networkManager()->get(QNetworkRequest(url)); } else if (method == "POST") { @@ -80,6 +80,10 @@ void DevicePluginHttpCommander::executeAction(DeviceActionInfo *info) reply = hardwareManager()->networkManager()->put(QNetworkRequest(url), payload); } else if (method == "DELETE") { reply = hardwareManager()->networkManager()->deleteResource(QNetworkRequest(url)); + } else { + qCWarning(dcHttpCommander()) << "Unsupported HTTP method" << method; + info->finish(Device::DeviceErrorInvalidParameter); + return; } connect(reply, &QNetworkReply::finished, this, [device, reply, this](){