Skip to content

Commit

Permalink
Fix logging crashing the game
Browse files Browse the repository at this point in the history
  • Loading branch information
Hirtol committed Jan 27, 2021
1 parent 539b777 commit 6a1559c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion PartyScreenEnhancements/Logging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static void Initialise()

public static void Log(Levels level, string message)
{
File.AppendText($"[{level.ToString()}] {message}");
File.AppendAllText(LOG_FILE, $"[{level}] {message}");
}


Expand Down
5 changes: 2 additions & 3 deletions PartyScreenEnhancements/ViewModel/UpgradeAllTroopsVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ private void UpgradeAllTroopsPath(int shouldUseOnlyDictInt)

try
{

foreach (PartyCharacterVM character in _mainPartyList)
{
if (character == null) continue;
Expand Down Expand Up @@ -88,8 +87,8 @@ private void UpgradeAllTroopsPath(int shouldUseOnlyDictInt)
}
catch (Exception e)
{
Logging.Log(Logging.Levels.ERROR, $"Upgrade All Troops: {e}");
Utilities.DisplayMessage($"PSE UpgradeTroops exception: {e}");
Logging.Log(Logging.Levels.ERROR, $"Upgrade All Troops: {e}");
}
}

Expand All @@ -98,7 +97,7 @@ private void Upgrade(PartyCharacterVM character, int upgradeIndex, ref int total
//Somehow, for some people, character seems to be null at random times. Haven't been able to reproduce it so far
//So this simple null check will have to stay.
if (character == null) return;

var anyInsufficient =
upgradeIndex == 0 ? character.IsUpgrade1Insufficient : character.IsUpgrade2Insufficient;
anyInsufficient = upgradeIndex == HALF_HALF_VALUE
Expand Down

0 comments on commit 6a1559c

Please sign in to comment.