From 94be479de298fd23628d0b9bcfb424f552be5ea1 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 7 Jan 2023 19:06:47 -0600 Subject: fail more gracefully on bad input --- src/slskd/Program.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/slskd/Program.cs') diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index 28ef7279..183f8426 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -243,7 +243,17 @@ namespace slskd // populate the properties above so that we can override the default config file if needed, and to // check if the application is being run in command mode (run task and quit). EnvironmentVariables.Populate(prefix: EnvironmentVariablePrefix); + + try + { Arguments.Populate(clearExistingValues: false); + } + catch (Exception ex) + { + // this is pretty hacky, but i don't have a good way of trapping errors that bubble up here. + Log.Error($"Invalid command line input: {ex.Message.Replace(". See inner exception for details.", string.Empty)}"); + return; + } // if a user has used one of the arguments above, perform the requested task, then quit if (ShowVersion) -- cgit v1.2.3