Details
-
Bug
-
Resolution: Incomplete
-
P1: Critical
-
None
-
5.8.0
-
None
Description
Investigating a crash I discovered that null pointers returned to QML are able to pass conditional statements as true.
class Something {...}; Q_DECLARE_METATYPE(Something*) ... qRegisterMetaType<Something*>(); ... Q_INVOKABLE Something* get() { return nullptr; } ... // in QML if (Obj.get()) // its true
I don't think it is unreasonable to expect that a null pointer gets evaluated as null and therefore as false on the JS side. Yet regardless of whether it is or isn't a null pointer, it always passes and in the console it just says `QVariant(Something*)`