summaryrefslogtreecommitdiff
path: root/Services/LaunchServer
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-12-24 01:44:20 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-24 10:25:18 +0100
commit0729c8ed65cf284fa9a275cbaf4cfa490aeb5309 (patch)
treefd086766bff00d3799f4b13b258ca4695efd4376 /Services/LaunchServer
parentbed240d4b38fa33cf85dab1549cb78118bcfc238 (diff)
downloadserenity-0729c8ed65cf284fa9a275cbaf4cfa490aeb5309.zip
LaunchServer: Ignore empty FileType / Protocol / [Launcher] config values
"Foo=" should be treated the same as "Foo" being missing.
Diffstat (limited to 'Services/LaunchServer')
-rw-r--r--Services/LaunchServer/Launcher.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/Services/LaunchServer/Launcher.cpp b/Services/LaunchServer/Launcher.cpp
index 2f796d7d9a..2638bf572d 100644
--- a/Services/LaunchServer/Launcher.cpp
+++ b/Services/LaunchServer/Launcher.cpp
@@ -107,8 +107,12 @@ void Launcher::load_handlers(const String& af_dir)
HashTable<String> table;
auto config_value = af->read_entry("Launcher", key, {});
- for (auto& key : config_value.split(','))
- table.set(key.to_lowercase());
+ for (auto& entry : config_value.split(',')) {
+ auto key = entry.trim_whitespace().to_lowercase();
+ if (key.is_empty())
+ continue;
+ table.set(key);
+ }
return table;
};
@@ -140,11 +144,17 @@ void Launcher::load_handlers(const String& af_dir)
void Launcher::load_config(const Core::ConfigFile& cfg)
{
for (auto key : cfg.keys("FileType")) {
- m_file_handlers.set(key.to_lowercase(), cfg.read_entry("FileType", key));
+ auto handler = cfg.read_entry("FileType", key).trim_whitespace();
+ if (handler.is_empty())
+ continue;
+ m_file_handlers.set(key.to_lowercase(), handler);
}
for (auto key : cfg.keys("Protocol")) {
- m_protocol_handlers.set(key.to_lowercase(), cfg.read_entry("Protocol", key));
+ auto handler = cfg.read_entry("Protocol", key).trim_whitespace();
+ if (handler.is_empty())
+ continue;
+ m_protocol_handlers.set(key.to_lowercase(), handler);
}
}