Amperfied: Fix a crash when the Modbus RTU Master is removed
parent
ba922c7e7e
commit
ac47803265
|
|
@ -270,6 +270,11 @@ void IntegrationPluginAmperfied::setupRtuConnection(ThingSetupInfo *info)
|
|||
{
|
||||
Thing *thing = info->thing();
|
||||
ModbusRtuMaster *master = hardwareManager()->modbusRtuResource()->getModbusRtuMaster(thing->paramValue(energyControlThingRtuMasterParamTypeId).toUuid());
|
||||
if (!master) {
|
||||
qCWarning(dcAmperfied()) << "The Modbus Master is not available any more.";
|
||||
info->finish(Thing::ThingErrorHardwareNotAvailable, QT_TR_NOOP("The modbus RTU connection is not available."));
|
||||
return;
|
||||
}
|
||||
quint16 slaveId = thing->paramValue(energyControlThingSlaveIdParamTypeId).toUInt();
|
||||
AmperfiedModbusRtuConnection *connection = new AmperfiedModbusRtuConnection(master, slaveId, thing);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue