mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
TextEditor: Fix crash on startup when file specified cannot be opened
Due to a bug introduced in f674102
, TE would attempt to access the value
of an ErrorOr that didn't hold one, hitting an assertion.
This commit is contained in:
parent
f5c5efa067
commit
c93dfe8097
1 changed files with 5 additions and 2 deletions
|
@ -76,8 +76,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
FileArgument parsed_argument(file_to_edit);
|
||||
auto response = FileSystemAccessClient::Client::the().try_request_file_read_only_approved(window, parsed_argument.filename());
|
||||
|
||||
if (response.is_error() && response.error().code() == ENOENT) {
|
||||
text_widget->open_nonexistent_file(parsed_argument.filename());
|
||||
if (response.is_error()) {
|
||||
if (response.error().code() == ENOENT)
|
||||
text_widget->open_nonexistent_file(parsed_argument.filename());
|
||||
else
|
||||
return 1;
|
||||
} else {
|
||||
if (!text_widget->read_file(*response.value()))
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue