diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2023-03-01 00:11:43 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-03-01 10:47:19 +0100 |
commit | 500044906d1b90f1c8b1a2f5675a2f82ab92b758 (patch) | |
tree | 7d6aae259b188c1b6879c591eebdfd7f55d9b71c /Userland/Applications/FontEditor | |
parent | 60908adcbe2afd611233957bb3126f736eb18e25 (diff) | |
download | serenity-500044906d1b90f1c8b1a2f5675a2f82ab92b758.zip |
LibCore+Everywhere: Remove ArgsParser::add*(char const*&)
This is not guaranteed to always work correctly as ArgsParser deals in
StringViews and might have a non-properly-null-terminated string as a
value. As a bonus, using StringView (and DeprecatedString where
necessary) leads to nicer looking code too :^)
Diffstat (limited to 'Userland/Applications/FontEditor')
-rw-r--r-- | Userland/Applications/FontEditor/main.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Applications/FontEditor/main.cpp b/Userland/Applications/FontEditor/main.cpp index 167f40b9e4..2eaa6eb824 100644 --- a/Userland/Applications/FontEditor/main.cpp +++ b/Userland/Applications/FontEditor/main.cpp @@ -28,7 +28,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Config::pledge_domain("FontEditor"); TRY(Core::System::pledge("stdio recvfd sendfd thread rpath cpath wpath")); - char const* path = nullptr; + StringView path; Core::ArgsParser args_parser; args_parser.add_positional_argument(path, "The font file for editing.", "file", Core::ArgsParser::Required::No); args_parser.parse(arguments); @@ -42,7 +42,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto font_editor = TRY(window->set_main_widget<FontEditor::MainWidget>()); TRY(font_editor->initialize_menubar(*window)); - if (path) { + if (!path.is_empty()) { TRY(font_editor->open_file(path)); } else { auto mutable_font = TRY(TRY(Gfx::BitmapFont::try_load_from_file("/res/fonts/KaticaRegular10.font"))->unmasked_character_set()); |