Skip to content

Commit

Permalink
Added guards on Steam install detection (#1444)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjf committed Sep 27, 2015
1 parent 93a6073 commit 7c9aafe
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Core/KSPPathUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,23 +145,23 @@ public static string KSPSteamPath()
if (line.Contains("BaseInstallFolder"))
{

//TODO: more robust parsing (currently assumes config file is valid)
// This assumes config file is valid, we just skip it if it looks funny.
string[] split_line = line.Split('"');

log.DebugFormat("Found a Steam Libary Location at {0}", split_line[3]);

ksp_path = KSPDirectory(split_line[3]);
if (ksp_path!= null)
if (split_line.Length > 3)
{
log.InfoFormat("Found a KSP install at {0}", ksp_path);
return ksp_path;
log.DebugFormat("Found a Steam Libary Location at {0}", split_line[3]);

ksp_path = KSPDirectory(split_line[3]);
if (ksp_path != null)
{
log.InfoFormat("Found a KSP install at {0}", ksp_path);
return ksp_path;
}
}

}
}

}


// Could not locate the folder.
return null;
Expand Down

0 comments on commit 7c9aafe

Please sign in to comment.