Skip to content
Snippets Groups Projects
Commit ccc46bbe authored by Eike Ziller's avatar Eike Ziller
Browse files

Fix crashes with (Runnable|Connection)::is<T>()


Another regression of 3f11ef92
Default constructed Runnables/Connections have zero d pointer.

Task-number: QTCREATORBUG-16507
Change-Id: I230b661eba4c408a353a711f93f3163160980793
Reviewed-by: default avatarMaurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
parent 43869721
Branches
Tags
No related merge requests found
...@@ -195,7 +195,7 @@ public: ...@@ -195,7 +195,7 @@ public:
void operator=(Runnable other) { d = std::move(other.d); } void operator=(Runnable other) { d = std::move(other.d); }
template <class T> bool is() const { template <class T> bool is() const {
return d.get()->typeId() == T::staticTypeId; return d.get() && (d.get()->typeId() == T::staticTypeId);
} }
template <class T> const T &as() const { template <class T> const T &as() const {
...@@ -219,7 +219,7 @@ public: ...@@ -219,7 +219,7 @@ public:
void operator=(Connection other) { d = std::move(other.d); } void operator=(Connection other) { d = std::move(other.d); }
template <class T> bool is() const { template <class T> bool is() const {
return d.get()->typeId() == T::staticTypeId; return d.get() && (d.get()->typeId() == T::staticTypeId);
} }
template <class T> const T &as() const { template <class T> const T &as() const {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment