summaryrefslogtreecommitdiffstats
path: root/src/remoteobjects/qremoteobjectnode.cpp
diff options
context:
space:
mode:
authorZhang Hao <zhanghao@uniontech.com>2022-01-27 13:54:04 +0800
committerZhang Hao <zhanghao@uniontech.com>2022-02-10 01:07:53 +0000
commitf11c40b55f3657663473865e8b644ed8c963f501 (patch)
tree88461ddafe3de73d8570125127769fa5ac1333c8 /src/remoteobjects/qremoteobjectnode.cpp
parent7cd75d8cd781f8574a03036ccbea0d3554824ec9 (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 Pick-to: 5.15 6.2 6.3 Done-with: sona.kurazyan@qt.io Change-Id: I1f73589958ba08d3997193653b57a64a223cd201 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src/remoteobjects/qremoteobjectnode.cpp')
-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();
}
/*!