forked from qt-creator/qt-creator
ClangFormat: Fix crashes when new project is created
Indenter is used by wizards so make sure it works. Change-Id: If26eae322e26bf2e32cb86acf45e7b3d33b67e98 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -84,7 +84,10 @@ Utils::optional<TabSettings> ClangFormatIndenter::tabSettings() const
|
||||
|
||||
int ClangFormatIndenter::lastSaveRevision() const
|
||||
{
|
||||
return qobject_cast<TextEditor::TextDocumentLayout *>(m_doc->documentLayout())->lastSaveRevision;
|
||||
auto *layout = qobject_cast<TextEditor::TextDocumentLayout *>(m_doc->documentLayout());
|
||||
if (!layout)
|
||||
return 0;
|
||||
return layout->lastSaveRevision;
|
||||
}
|
||||
|
||||
bool ClangFormatIndenter::formatOnSave() const
|
||||
|
||||
Reference in New Issue
Block a user