From a9fe0f5aacce3fe4c47f8c9150e5cdcd3d54900a Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Sat, 17 Feb 2024 13:25:56 -0600 Subject: [PATCH] Fix bug for first time runs Properly handles the case where a user will install the plugin without any config defined. Creating a URI with an empty string will throw an exception --- LANCommander.SDK/Client.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/LANCommander.SDK/Client.cs b/LANCommander.SDK/Client.cs index 3aa06651..6cfad48f 100644 --- a/LANCommander.SDK/Client.cs +++ b/LANCommander.SDK/Client.cs @@ -60,7 +60,12 @@ namespace LANCommander.SDK public Client(string baseUrl, string defaultInstallDirectory, ILogger logger) { - BaseUrl = new Uri(baseUrl); + if (!String.IsNullOrWhiteSpace(baseUrl)) + { + BaseUrl = new Uri(baseUrl); + ApiClient = new RestClient(BaseUrl); + } + DefaultInstallDirectory = defaultInstallDirectory; Games = new GameService(this, DefaultInstallDirectory, logger); @@ -69,9 +74,6 @@ namespace LANCommander.SDK Actions = new ActionService(this); Profile = new ProfileService(this, logger); - if (!String.IsNullOrWhiteSpace(baseUrl)) - ApiClient = new RestClient(BaseUrl); - Logger = logger; }