Fix SEGV when closing deCONZ
@@ -907,6 +907,7 @@ DeRestPluginPrivate::DeRestPluginPrivate(QObject *parent) :
*/
DeRestPluginPrivate::~DeRestPluginPrivate()
{
+ plugin = nullptr;
if (inetDiscoveryManager)
{
inetDiscoveryManager->deleteLater();
@@ -19859,10 +19860,15 @@ Resource *DeRestPluginPrivate::getResource(const char *resource, const QString &
// Used by Device class when querying resources.
// Testing code uses a mocked implementation.
Resource *DEV_GetResource(const char *resource, const QString &identifier)
+{
+ if (plugin)
{
return plugin->getResource(resource, identifier);
}
+ return nullptr;
+}
+
// Used by Device class when creating Sensors.
// Testing code uses a mocked implementation.
Resource *DEV_AddResource(const Sensor &sensor)
