diff --git a/Core/GameInstanceManager.cs b/Core/GameInstanceManager.cs
index a3942d7c92..d1d2e9cfcf 100644
--- a/Core/GameInstanceManager.cs
+++ b/Core/GameInstanceManager.cs
@@ -206,7 +206,7 @@ public GameInstance AddInstance(string path, string name, IUser user)
{
var game = DetermineGame(new DirectoryInfo(path), user);
if (game == null)
- throw new NotKSPDirKraken(path);
+ return null;
return AddInstance(new GameInstance(game, path, name, user));
}
@@ -608,14 +608,15 @@ public static bool IsGameInstanceDir(DirectoryInfo path)
///
/// A DirectoryInfo of the path to check
/// IUser object for interaction
- /// An instance of the matching game, or null if none could be found
+ /// An instance of the matching game or null if the user cancelled
+ /// Thrown when no games found
public IGame DetermineGame(DirectoryInfo path, IUser user)
{
var matchingGames = knownGames.Where(g => g.GameInFolder(path)).ToList();
switch (matchingGames.Count)
{
case 0:
- return null;
+ throw new NotKSPDirKraken(path.FullName);
case 1:
return matchingGames.First();
diff --git a/GUI/Dialogs/CloneFakeGameDialog.cs b/GUI/Dialogs/CloneFakeGameDialog.cs
index 5f3e865942..e6bf3006cf 100644
--- a/GUI/Dialogs/CloneFakeGameDialog.cs
+++ b/GUI/Dialogs/CloneFakeGameDialog.cs
@@ -146,13 +146,14 @@ private async void buttonOK_Click(object sender, EventArgs e)
try
{
IGame guessedGame = manager.DetermineGame(new DirectoryInfo(existingPath), user);
+ if (guessedGame == null)
+ {
+ // User cancelled, let them try again
+ reactivateDialog();
+ return;
+ }
await Task.Run(() =>
{
- if (guessedGame == null)
- {
- throw new NotKSPDirKraken(existingPath);
- }
-
GameInstance instanceToClone = new GameInstance(
guessedGame,
existingPath,