From 7ff668683a82a4ba92af2e9da92dc34df363367f Mon Sep 17 00:00:00 2001 From: Boernsman Date: Sun, 12 Sep 2021 20:26:01 +0200 Subject: [PATCH] fixed crash on avahi discovery --- ws2812fx/integrationpluginws2812fx.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ws2812fx/integrationpluginws2812fx.cpp b/ws2812fx/integrationpluginws2812fx.cpp index 9129da56..ff8695d1 100644 --- a/ws2812fx/integrationpluginws2812fx.cpp +++ b/ws2812fx/integrationpluginws2812fx.cpp @@ -70,6 +70,10 @@ void IntegrationPluginWs2812fx::init() return; } NymeaLightTcpInterface *lightInterface = qobject_cast(m_lights.value(thing)->parent()); + if (!lightInterface) { + qCWarning(dcWs2812fx()) << "Invalid NymeaLightInterface pointer for" << thing; + return; + } lightInterface->setAddress(entry.hostAddress()); }); } @@ -106,8 +110,8 @@ void IntegrationPluginWs2812fx::setupThing(ThingSetupInfo *info) return; } - NymeaLightTcpInterface *lightInterface = new NymeaLightTcpInterface(QHostAddress(interface)); - light = new NymeaLight(lightInterface, this); + NymeaLightTcpInterface *lightInterface = new NymeaLightTcpInterface(QHostAddress(interface), thing); + light = new NymeaLight(lightInterface, lightInterface); lightInterface->setParent(light); }