1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:47:34 +00:00

AK: Make "foo"_string infallible

Stop worrying about tiny OOMs.

Work towards #20405.
This commit is contained in:
Andreas Kling 2023-08-07 11:12:38 +02:00
parent db2a8725c6
commit 34344120f2
181 changed files with 626 additions and 630 deletions

View file

@ -1418,7 +1418,7 @@ ErrorOr<int> Shell::builtin_argsparser_parse(Main::Arguments arguments)
auto try_convert = [](StringView value, Type type) -> ErrorOr<Optional<RefPtr<AST::Value>>> {
switch (type) {
case Type::Bool:
return AST::make_ref_counted<AST::StringValue>(TRY("true"_string));
return AST::make_ref_counted<AST::StringValue>("true"_string);
case Type::String:
return AST::make_ref_counted<AST::StringValue>(TRY(String::from_utf8(value)));
case Type::I32:
@ -1602,7 +1602,7 @@ ErrorOr<int> Shell::builtin_argsparser_parse(Main::Arguments arguments)
if (type == Type::Bool) {
set_local_variable(
current_variable,
make_ref_counted<AST::StringValue>(MUST("false"_string)),
make_ref_counted<AST::StringValue>("false"_string),
true);
}
return true;