aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsregistercontent.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-04-06 11:52:25 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-04-07 14:40:51 +0200
commit3293f5d68d6a80a61710ec2bd82d03b2e79b21e2 (patch)
tree9d017e7a4734f48986319a233e859861747000c0 /src/qmlcompiler/qqmljsregistercontent.cpp
parent37fd49d23649c63516c109012b20bce86353cf85 (diff)
QmlCompiler: Allow retrieval of descriptive name from invalid types
Apparently we do that somewhere. It should not just crash. Task-number: QTBUG-102147 Change-Id: Id612e0543d8794aa4f334a899b117142b7a8cd38 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 388ccd7b6fdc9474248c1a6bcc67f63d7b017489)
Diffstat (limited to 'src/qmlcompiler/qqmljsregistercontent.cpp')
-rw-r--r--src/qmlcompiler/qqmljsregistercontent.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qmlcompiler/qqmljsregistercontent.cpp b/src/qmlcompiler/qqmljsregistercontent.cpp
index aef0453eac..5932022503 100644
--- a/src/qmlcompiler/qqmljsregistercontent.cpp
+++ b/src/qmlcompiler/qqmljsregistercontent.cpp
@@ -33,8 +33,13 @@ QT_BEGIN_NAMESPACE
QString QQmlJSRegisterContent::descriptiveName() const
{
+ if (m_storedType.isNull())
+ return u"(invalid type)"_qs;
+
QString result = m_storedType->internalName() + u" of "_qs;
const auto scope = [this]() -> QString {
+ if (m_scope.isNull())
+ return u"(invalid type)::"_qs;
return (m_scope->internalName().isEmpty()
? (m_scope->fileName().isEmpty()
? u"??"_qs