QmlDesigner: Fix crash when 'Debug QML emulation layer' is enabled

Timer was accessed before creation in this case.

Change-Id: I8817043f1a875cb4c7c6cf8a1f4b398f78058509
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2020-12-10 17:50:46 +02:00
parent 1ff6f27286
commit 20f11c961e

View File

@@ -101,7 +101,7 @@ void InteractiveConnectionManager::dispatchCommand(const QVariant &command, Conn
void InteractiveConnectionManager::puppetTimeout(Connection &connection) void InteractiveConnectionManager::puppetTimeout(Connection &connection)
{ {
if (connection.socket && connection.socket->waitForReadyRead(10)) { if (connection.timer && connection.socket && connection.socket->waitForReadyRead(10)) {
connection.timer->stop(); connection.timer->stop();
connection.timer->start(); connection.timer->start();
return; return;
@@ -112,8 +112,10 @@ void InteractiveConnectionManager::puppetTimeout(Connection &connection)
void InteractiveConnectionManager::puppetAlive(Connection &connection) void InteractiveConnectionManager::puppetAlive(Connection &connection)
{ {
connection.timer->stop(); if (connection.timer) {
connection.timer->start(); connection.timer->stop();
connection.timer->start();
}
} }
} // namespace QmlDesigner } // namespace QmlDesigner