fixed segfault

This commit is contained in:
Boernsman 2020-12-14 10:11:18 +01:00
parent 816de5b538
commit 22a448403a

View File

@ -883,7 +883,8 @@ void IntegrationPluginHomeConnect::onConnectionChanged(bool connected)
void IntegrationPluginHomeConnect::onAuthenticationStatusChanged(bool authenticated) void IntegrationPluginHomeConnect::onAuthenticationStatusChanged(bool authenticated)
{ {
qCDebug(dcHomeConnect()) << "Authentication changed" << authenticated; qCDebug(dcHomeConnect()) << "Authentication changed" << authenticated;
HomeConnect *homeConnectConnection = static_cast<HomeConnect *>(sender());
HomeConnect *homeConnectConnection = static_cast<HomeConnect *>(sender());
if (m_asyncSetup.contains(homeConnectConnection)) { if (m_asyncSetup.contains(homeConnectConnection)) {
ThingSetupInfo *info = m_asyncSetup.take(homeConnectConnection); ThingSetupInfo *info = m_asyncSetup.take(homeConnectConnection);
if (authenticated) { if (authenticated) {
@ -926,6 +927,7 @@ void IntegrationPluginHomeConnect::onRequestExecuted(QUuid requestId, bool succe
void IntegrationPluginHomeConnect::onReceivedHomeAppliances(const QList<HomeConnect::HomeAppliance> &appliances) void IntegrationPluginHomeConnect::onReceivedHomeAppliances(const QList<HomeConnect::HomeAppliance> &appliances)
{ {
qCDebug(dcHomeConnect()) << "Received home appliances list, with" << appliances.count() << "entries"; qCDebug(dcHomeConnect()) << "Received home appliances list, with" << appliances.count() << "entries";
HomeConnect *homeConnectConnection = static_cast<HomeConnect *>(sender()); HomeConnect *homeConnectConnection = static_cast<HomeConnect *>(sender());
Thing *parentThing = m_homeConnectConnections.key(homeConnectConnection); Thing *parentThing = m_homeConnectConnections.key(homeConnectConnection);
if (!parentThing) if (!parentThing)
@ -969,8 +971,9 @@ void IntegrationPluginHomeConnect::onReceivedHomeAppliances(const QList<HomeConn
continue; continue;
} }
if (!myThings().findByParams(ParamList() << Param(m_idParamTypeIds.value(thingClassId), appliance.homeApplianceId))) { Thing * existingThing = myThings().findByParams(ParamList() << Param(m_idParamTypeIds.value(thingClassId), appliance.homeApplianceId));
Thing * existingThing = myThings().findByParams(ParamList() << Param(m_idParamTypeIds.value(thingClassId), appliance.homeApplianceId)); if (existingThing) {
qCDebug(dcHomeConnect()) << "Thing is already added to system" << existingThing->name();
existingThing->setStateValue(m_connectedStateTypeIds.value(thingClassId), appliance.connected); existingThing->setStateValue(m_connectedStateTypeIds.value(thingClassId), appliance.connected);
continue; continue;
} }
@ -1033,10 +1036,9 @@ void IntegrationPluginHomeConnect::onReceivedEvents(HomeConnect::EventType event
} }
} break; } break;
case HomeConnect::EventTypePaired: { case HomeConnect::EventTypePaired: {
//TODO add device
} break; } break;
case HomeConnect::EventTypeDepaired: { case HomeConnect::EventTypeDepaired: {
//TODO remove device emit autoThingDisappeared(thing->id());
} break; } break;
} }
break; break;