mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:15:06 +00:00
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.
This commit is contained in:
parent
d56786ccd8
commit
b1bc7a1b5d
1 changed files with 1 additions and 2 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue