Skip to content

Commit

Permalink
ProgressRestorer: Catch achievement related exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
benediktwerner committed Feb 10, 2021
1 parent b5b7099 commit 82b6c92
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion ProgressRestorer/Main.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using System;
using System.Linq;
using UnityEngine;

Expand All @@ -13,6 +15,8 @@ public class Main : BaseUnityPlugin
public const string Name = "ProgressRestorer";
public const string Version = "1.1.0";

static ManualLogSource StaticLogger;

static bool showBadges = false;
static bool showAchievements = false;
static int? selectedMission = null;
Expand All @@ -33,6 +37,8 @@ void Awake()
}
)
);

StaticLogger = Logger;
}

static void Draw(ConfigEntryBase entry)
Expand Down Expand Up @@ -70,7 +76,15 @@ static void Draw(ConfigEntryBase entry)
if (showAchievements)
{
GUILayout.BeginVertical("box");
DrawAchievements();
try
{
DrawAchievements();
}
catch (Exception e)
{
StaticLogger.LogError(e);
message = "Error:\n" + e.ToString();
}
GUILayout.EndVertical();
}

Expand Down

0 comments on commit 82b6c92

Please sign in to comment.