1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 17:18:11 +00:00

HexEditor: Created has_selection() method.

Created has_selection() method and fixed a few small issues.
This commit is contained in:
Brandon Scott 2019-10-26 17:41:59 -05:00 committed by Andreas Kling
parent c77fe5161c
commit 98e556fee9
3 changed files with 7 additions and 6 deletions

View file

@ -56,13 +56,13 @@ HexEditorWidget::HexEditorWidget()
if (input_box->exec() == GInputBox::ExecOK && !input_box->text_value().is_empty()) {
auto valid = false;
auto file_size = input_box->text_value().to_int(valid);
if (valid) {
if (valid && file_size > 0) {
m_document_dirty = false;
m_editor->set_buffer(ByteBuffer::create_zeroed(file_size));
set_path(FileSystemPath());
update_title();
} else {
GMessageBox::show(String::format("Invalid file size entered.", strerror(errno)), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window());
GMessageBox::show("Invalid file size entered.", "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window());
}
}
});