1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:27:35 +00:00

HexEditor: Propagate errors when using "Save"

This commit is contained in:
Lucas CHOLLET 2023-01-14 22:09:43 -05:00 committed by Andrew Kaster
parent 2bba743c24
commit a2dca2b762
5 changed files with 13 additions and 13 deletions

View file

@ -153,14 +153,13 @@ ErrorOr<void> HexEditor::save_as(NonnullOwnPtr<Core::Stream::File> new_file)
return {};
}
bool HexEditor::save()
ErrorOr<void> HexEditor::save()
{
if (m_document->type() != HexDocument::Type::File) {
return false;
}
if (m_document->type() != HexDocument::Type::File)
return Error::from_string_literal("Unable to save from a memory document");
static_cast<HexDocumentFile*>(m_document.ptr())->write_to_file();
return true;
TRY(static_cast<HexDocumentFile*>(m_document.ptr())->write_to_file());
return {};
}
size_t HexEditor::selection_size()