forked from qt-creator/qt-creator
Document model: Use optional for "indexOf" kind of methods
Change-Id: Iaffbb0b695f96b5b44c9fd0df63891c2797181b7 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -73,6 +73,7 @@
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/savedaction.h>
|
||||
#include <utils/stylehelper.h>
|
||||
|
||||
@@ -2209,9 +2210,12 @@ void FakeVimPluginPrivate::highlightMatches(FakeVimHandler *, const QString &nee
|
||||
int FakeVimPluginPrivate::currentFile() const
|
||||
{
|
||||
IEditor *editor = EditorManager::currentEditor();
|
||||
if (!editor)
|
||||
return -1;
|
||||
return DocumentModel::indexOfDocument(editor->document());
|
||||
if (editor) {
|
||||
const Utils::optional<int> index = DocumentModel::indexOfDocument(editor->document());
|
||||
if (QTC_GUARD(index))
|
||||
return index.value();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::switchToFile(int n)
|
||||
|
||||
Reference in New Issue
Block a user