Fix bug for first time runs
Some checks failed
LANCommander Playnite Plugin / build (push) Has been cancelled
LANCommander / build (push) Has been cancelled
LANCommander Release / build (push) Has been cancelled

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
This commit is contained in:
Pat Hartl 2024-02-17 13:25:56 -06:00
parent e286ec4452
commit a9fe0f5aac

View file

@ -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;
}