diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-08-23 19:10:14 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-08-23 19:11:56 +0200 |
commit | b1bc7a1b5d9f436c7b2178b596b32a57ff990618 (patch) | |
tree | e524f0d511f02f6ec5d41ea523e9cc6fc889ddf2 /Applications/TextEditor | |
parent | d56786ccd8dc6761d28e7ef0f4d6732c9a1d0c77 (diff) | |
download | serenity-b1bc7a1b5d9f436c7b2178b596b32a57ff990618.zip |
TextEditor: Don't try to load contents of files we didn't even open
If the CFile::open() call fails, we shouldn't continue with trying to
load the file.
Diffstat (limited to 'Applications/TextEditor')
-rw-r--r-- | Applications/TextEditor/TextEditorWidget.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Applications/TextEditor/TextEditorWidget.cpp b/Applications/TextEditor/TextEditorWidget.cpp index e316e1de78..cf006278fb 100644 --- a/Applications/TextEditor/TextEditorWidget.cpp +++ b/Applications/TextEditor/TextEditorWidget.cpp @@ -192,11 +192,10 @@ void TextEditorWidget::set_path(const FileSystemPath& file) void TextEditorWidget::open_sesame(const String& path) { - dbgprintf("Our path to file in open_sesame: %s\n", path.characters()); CFile file(path); - if (!file.open(CIODevice::ReadOnly)) { GMessageBox::show(String::format("Opening \"%s\" failed: %s", path.characters(), strerror(errno)), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window()); + return; } m_editor->set_text(file.read_all()); |