1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

Web API: fixed segfault in WebAPIAdapterGUI::devicesetDeviceSettingsPutPatch

This commit is contained in:
f4exb 2017-12-14 23:12:52 +01:00
parent e817974bb3
commit 3e0918c768

View File

@ -746,7 +746,12 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsPutPatch(
if (deviceSet->m_deviceSourceEngine) // Rx
{
if ((response.getTx() != 0) || (deviceSet->m_deviceSourceAPI->getHardwareId() != *response.getDeviceHwType()))
if (response.getTx() != 0)
{
*error.getMessage() = QString("Rx device found but Tx device requested");
return 400;
}
if (deviceSet->m_deviceSourceAPI->getHardwareId() != *response.getDeviceHwType())
{
*error.getMessage() = QString("Device mismatch. Found %1 input").arg(deviceSet->m_deviceSourceAPI->getHardwareId());
return 400;
@ -759,9 +764,14 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsPutPatch(
}
else if (deviceSet->m_deviceSinkEngine) // Tx
{
if ((response.getTx() == 0) || (deviceSet->m_deviceSourceAPI->getHardwareId() != *response.getDeviceHwType()))
if (response.getTx() == 0)
{
*error.getMessage() = QString("Device mismatch. Found %1 output").arg(deviceSet->m_deviceSourceAPI->getHardwareId());
*error.getMessage() = QString("Tx device found but Rx device requested");
return 400;
}
else if (deviceSet->m_deviceSinkAPI->getHardwareId() != *response.getDeviceHwType())
{
*error.getMessage() = QString("Device mismatch. Found %1 output").arg(deviceSet->m_deviceSinkAPI->getHardwareId());
return 400;
}
else