forked from qt-creator/qt-creator
QmlDesigner: Fix crash when accessing optional
Task-number: QDS-9439
Change-Id: Ic80ea2558f6b41da127000441a75773d382f5a05
(cherry picked from commit 925b08d6e6
)
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -368,8 +368,11 @@ void ToolBarBackend::updateDocumentModel()
|
|||||||
|
|
||||||
int ToolBarBackend::documentIndex() const
|
int ToolBarBackend::documentIndex() const
|
||||||
{
|
{
|
||||||
if (Core::EditorManager::currentDocument())
|
if (Core::EditorManager::currentDocument()) {
|
||||||
return Core::DocumentModel::indexOfDocument(Core::EditorManager::currentDocument()).value();
|
std::optional index = Core::DocumentModel::indexOfDocument(
|
||||||
|
Core::EditorManager::currentDocument());
|
||||||
|
return index.value_or(-1);
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user