mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
HexEditor: Handle some errors inside the editor
Specifically, the ones HexEditor::did_complete_action possibly raised in case creating an undo stack entry or pushing it onto the undo stack fails. In this case, an error popup is displayed and the modifications are undone. This removes 2 FIXMEs inside the code :^)
This commit is contained in:
parent
d3ce9cf8f6
commit
2dd7fa2d44
3 changed files with 60 additions and 29 deletions
|
@ -245,7 +245,9 @@ HexEditorWidget::HexEditorWidget()
|
|||
DeprecatedString value;
|
||||
if (GUI::InputBox::show(window(), value, "Fill byte (hex):"sv, "Fill Selection"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) {
|
||||
auto fill_byte = strtol(value.characters(), nullptr, 16);
|
||||
m_editor->fill_selection(fill_byte);
|
||||
auto result = m_editor->fill_selection(fill_byte);
|
||||
if (result.is_error())
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("{}", result.error()));
|
||||
}
|
||||
});
|
||||
m_fill_selection_action->set_enabled(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue