solid: check if the object is null before qobject_cast<T>()-ing it in return_SOLID_CALL() macro

fixes possible crashes, notably on FreeBSD the backend of which does not
implement all interfaces

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-10 09:15:24 +03:00
parent b46e8b1170
commit 5e8ef901ce

View file

@ -24,8 +24,11 @@
#include <QtCore/QObject>
#define return_SOLID_CALL(Type, Object, Default, Method) \
if (Object == nullptr) { \
return Default; \
} \
Type t = qobject_cast<Type>(Object); \
if (t!=0) \
if (t != nullptr) \
{ \
return t->Method; \
} \