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

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

Task-number: QTCREATORBUG-16507
Change-Id: I230b661eba4c408a353a711f93f3163160980793
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Eike Ziller
2016-06-28 13:28:28 +02:00
parent 438697219f
commit ccc46bbe46

View File

@@ -195,7 +195,7 @@ public:
void operator=(Runnable other) { d = std::move(other.d); }
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 {
@@ -219,7 +219,7 @@ public:
void operator=(Connection other) { d = std::move(other.d); }
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 {