aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/fakevim
diff options
context:
space:
mode:
authorRobert Loehning <robert.loehning@qt.io>2017-02-17 17:45:56 +0100
committerRobert Loehning <robert.loehning@qt.io>2017-02-17 17:49:19 +0000
commit6c8b1e268ac8d6597589da64d91c54666310c4a9 (patch)
tree35c5b7126af5dffebb8940642f4342ae388f5d9c /src/plugins/fakevim
parent2d9dc5a27f019125f12cd7a0dff0d5f615f88728 (diff)
FakeVim: Don't try to read from file which could not be opened
Change-Id: I3468d1a4c9e3ba7bcfd6526f5541b3ec4e84a3e4 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/fakevim')
-rw-r--r--src/plugins/fakevim/fakevimplugin.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp
index c26ebe71a5f..b968b857e1c 100644
--- a/src/plugins/fakevim/fakevimplugin.cpp
+++ b/src/plugins/fakevim/fakevimplugin.cpp
@@ -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));
+ }
}
}