From 878a27d875431acacd888da0b58a9ff470ef2892 Mon Sep 17 00:00:00 2001 From: bcssov Date: Sun, 10 Sep 2023 20:36:40 +0200 Subject: [PATCH] Check if valid GOG path --- .../Registrations/GameRegistration.cs | 7 +++++-- src/IronyModManager.Services/Registrations/GogDirectory.cs | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/IronyModManager.Services/Registrations/GameRegistration.cs b/src/IronyModManager.Services/Registrations/GameRegistration.cs index 8bcaf1f1..5c66fb1e 100644 --- a/src/IronyModManager.Services/Registrations/GameRegistration.cs +++ b/src/IronyModManager.Services/Registrations/GameRegistration.cs @@ -5,7 +5,7 @@ // Created : 02-12-2020 // // Last Modified By : Mario -// Last Modified On : 06-25-2023 +// Last Modified On : 09-10-2023 // *********************************************************************** // // Mario @@ -143,7 +143,10 @@ private GameSettings GetExecutableSettings(IGameType game) if (!File.Exists(path) && game.GogAppId.HasValue) { basePath = GogDirectory.GetGameDirectory(game.GogAppId.GetValueOrDefault()); - path = Path.Combine(basePath, game.LauncherSettingsFileName); + if (!string.IsNullOrWhiteSpace(basePath)) + { + path = Path.Combine(basePath, game.LauncherSettingsFileName); + } } if (File.Exists(path)) { diff --git a/src/IronyModManager.Services/Registrations/GogDirectory.cs b/src/IronyModManager.Services/Registrations/GogDirectory.cs index 11958db4..b1f09b71 100644 --- a/src/IronyModManager.Services/Registrations/GogDirectory.cs +++ b/src/IronyModManager.Services/Registrations/GogDirectory.cs @@ -5,7 +5,7 @@ // Created : 07-15-2022 // // Last Modified By : Mario -// Last Modified On : 05-26-2023 +// Last Modified On : 09-10-2023 // *********************************************************************** // // Mario @@ -64,7 +64,7 @@ public static string GetGameDirectory(int? appId) var game = games.FirstOrDefault(p => p.Id == appId.GetValueOrDefault()); if (game != null) { - return game.Path; + return game.Path ?? string.Empty; } } return string.Empty;