Commit 6c8b1e26 authored by Robert Loehning's avatar Robert Loehning

FakeVim: Don't try to read from file which could not be opened

Change-Id: I3468d1a4c9e3ba7bcfd6526f5541b3ec4e84a3e4
Reviewed-by: default avatarhjk <hjk@qt.io>
parent 2d9dc5a2
......@@ -1964,12 +1964,13 @@ void FakeVimPluginPrivate::handleExCommand(FakeVimHandler *handler, bool *handle
saved = !editor->document()->isModified();
if (saved) {
QFile file3(fileName);
file3.open(QIODevice::ReadOnly);
const QByteArray ba = file3.readAll();
handler->showMessage(MessageInfo, Tr::tr("\"%1\" %2 %3L, %4C written")
.arg(fileName).arg(' ').arg(ba.count('\n')).arg(ba.size()));
if (cmd.cmd == "wq")
delayedQuitRequested(cmd.hasBang, m_editorToHandler.key(handler));
if (file3.open(QIODevice::ReadOnly)) {
const QByteArray ba = file3.readAll();
handler->showMessage(MessageInfo, Tr::tr("\"%1\" %2 %3L, %4C written")
.arg(fileName).arg(' ').arg(ba.count('\n')).arg(ba.size()));
if (cmd.cmd == "wq")
delayedQuitRequested(cmd.hasBang, m_editorToHandler.key(handler));
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment