summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang Hao <zhanghao@uniontech.com>2022-01-27 13:54:04 +0800
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-02-10 01:32:28 +0000
commit20b9e5c5901ff952faaa7478c9383616b1c0b702 (patch)
tree7c71ff25b4ee611e072cd265d07671f27fcf8a8c
parentb3a2c6f30df605f2a65777941768f99a1cba598c (diff)
Check nullptr before using pointer
Calling QRemoteObjectHost::hostUrl() will crash if remoteObjectIO is nullptr, so check if it's not nullptr before using it. Fixes: QTBUG-85124 Done-with: sona.kurazyan@qt.io Change-Id: I1f73589958ba08d3997193653b57a64a223cd201 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit f11c40b55f3657663473865e8b644ed8c963f501) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/remoteobjects/qremoteobjectnode.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/remoteobjects/qremoteobjectnode.cpp b/src/remoteobjects/qremoteobjectnode.cpp
index 07d7f90..82d1def 100644
--- a/src/remoteobjects/qremoteobjectnode.cpp
+++ b/src/remoteobjects/qremoteobjectnode.cpp
@@ -1972,7 +1972,9 @@ void QRemoteObjectHostBase::setName(const QString &name)
QUrl QRemoteObjectHostBase::hostUrl() const
{
Q_D(const QRemoteObjectHostBase);
- return d->remoteObjectIo->serverAddress();
+ if (d->remoteObjectIo)
+ return d->remoteObjectIo->serverAddress();
+ return QUrl();
}
/*!