1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +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

@ -83,15 +83,16 @@ HexDocumentFile::HexDocumentFile(NonnullOwnPtr<Core::Stream::File> file)
{
}
void HexDocumentFile::write_to_file()
ErrorOr<void> HexDocumentFile::write_to_file()
{
for (auto& change : m_changes) {
m_file->seek(change.key, SeekMode::SetPosition).release_value_but_fixme_should_propagate_errors();
m_file->write({ &change.value, 1 }).release_value_but_fixme_should_propagate_errors();
TRY(m_file->seek(change.key, SeekMode::SetPosition));
TRY(m_file->write({ &change.value, 1 }));
}
clear_changes();
// make sure the next get operation triggers a read
m_buffer_file_pos = m_file_size + 1;
return {};
}
ErrorOr<void> HexDocumentFile::write_to_file(Core::Stream::File& file)