mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
AK: Make string-to-number conversion helpers return Optional
Get rid of the weird old signature: - int StringType::to_int(bool& ok) const And replace it with sensible new signature: - Optional<int> StringType::to_int() const
This commit is contained in:
@@ -91,10 +91,9 @@ void TextEditor::create_actions()
|
||||
auto input_box = InputBox::construct("Line:", "Go to line", window());
|
||||
auto result = input_box->exec();
|
||||
if (result == InputBox::ExecOK) {
|
||||
bool ok;
|
||||
auto line_number = input_box->text_value().to_uint(ok);
|
||||
if (ok)
|
||||
set_cursor(line_number - 1, 0);
|
||||
auto line_number = input_box->text_value().to_uint();
|
||||
if (line_number.has_value())
|
||||
set_cursor(line_number.value() - 1, 0);
|
||||
}
|
||||
},
|
||||
this);
|
||||
|
||||
Reference in New Issue
Block a user