summaryrefslogtreecommitdiff
path: root/Userland/Applets
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2023-03-01 00:11:43 +0330
committerAndreas Kling <kling@serenityos.org>2023-03-01 10:47:19 +0100
commit500044906d1b90f1c8b1a2f5675a2f82ab92b758 (patch)
tree7d6aae259b188c1b6879c591eebdfd7f55d9b71c /Userland/Applets
parent60908adcbe2afd611233957bb3126f736eb18e25 (diff)
downloadserenity-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/Applets')
-rw-r--r--Userland/Applets/Network/main.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Applets/Network/main.cpp b/Userland/Applets/Network/main.cpp
index dcc936bfea..b361d983e9 100644
--- a/Userland/Applets/Network/main.cpp
+++ b/Userland/Applets/Network/main.cpp
@@ -173,14 +173,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::unveil(nullptr, nullptr));
bool display_notifications = false;
- char const* name = nullptr;
+ StringView name;
Core::ArgsParser args_parser;
args_parser.add_option(display_notifications, "Display notifications", "display-notifications", 'd');
args_parser.add_option(name, "Applet name used by WindowServer.ini to set the applet order", "name", 'n', "name");
args_parser.parse(arguments);
- if (name == nullptr)
- name = "Network";
+ if (name.is_empty())
+ name = "Network"sv;
auto window = TRY(GUI::Window::try_create());
window->set_title(name);