mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-24 21:28:29 -04:00
Web API: fixed missing initializations of error object
This commit is contained in:
parent
9f220f182c
commit
0162b1d2bc
@ -779,6 +779,8 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
error.init();
|
||||
|
||||
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
|
||||
{
|
||||
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
|
||||
@ -799,16 +801,13 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsGet(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
@ -820,6 +819,8 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsPutPatch(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
error.init();
|
||||
|
||||
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
|
||||
{
|
||||
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
|
||||
@ -828,13 +829,11 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsPutPatch(
|
||||
{
|
||||
if (response.getTx() != 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Rx device found but Tx device requested");
|
||||
return 400;
|
||||
}
|
||||
if (deviceSet->m_deviceSourceAPI->getHardwareId() != *response.getDeviceHwType())
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Device mismatch. Found %1 input").arg(deviceSet->m_deviceSourceAPI->getHardwareId());
|
||||
return 400;
|
||||
}
|
||||
@ -848,13 +847,11 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsPutPatch(
|
||||
{
|
||||
if (response.getTx() == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Tx device found but Rx device requested");
|
||||
return 400;
|
||||
}
|
||||
else if (deviceSet->m_deviceSinkAPI->getHardwareId() != *response.getDeviceHwType())
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Device mismatch. Found %1 output").arg(deviceSet->m_deviceSinkAPI->getHardwareId());
|
||||
return 400;
|
||||
}
|
||||
@ -866,14 +863,12 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsPutPatch(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
|
@ -884,6 +884,8 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsGet(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
error.init();
|
||||
|
||||
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
|
||||
{
|
||||
DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
|
||||
@ -904,14 +906,12 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsGet(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -924,6 +924,8 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsPutPatch(
|
||||
SWGSDRangel::SWGDeviceSettings& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
error.init();
|
||||
|
||||
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
|
||||
{
|
||||
DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
|
||||
@ -932,13 +934,11 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsPutPatch(
|
||||
{
|
||||
if (response.getTx() != 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Rx device found but Tx device requested");
|
||||
return 400;
|
||||
}
|
||||
if (deviceSet->m_deviceSourceAPI->getHardwareId() != *response.getDeviceHwType())
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Device mismatch. Found %1 input").arg(deviceSet->m_deviceSourceAPI->getHardwareId());
|
||||
return 400;
|
||||
}
|
||||
@ -952,13 +952,11 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsPutPatch(
|
||||
{
|
||||
if (response.getTx() == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Tx device found but Rx device requested");
|
||||
return 400;
|
||||
}
|
||||
else if (deviceSet->m_deviceSinkAPI->getHardwareId() != *response.getDeviceHwType())
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Device mismatch. Found %1 output").arg(deviceSet->m_deviceSinkAPI->getHardwareId());
|
||||
return 400;
|
||||
}
|
||||
@ -970,14 +968,12 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsPutPatch(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user