diff --git a/CHANGELOG.md b/CHANGELOG.md index ee5a8b9..faabe86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ **Changelog** -- +**
Version 1.3.7** + +**
Fixes** + +* Added additional safety checks to ExtendedFootstepSurface patches + +
+ +
+ **
Version 1.3.6** **
Features** diff --git a/LethalLevelLoader/General/Patches.cs b/LethalLevelLoader/General/Patches.cs index 3ae73f6..44bac57 100644 --- a/LethalLevelLoader/General/Patches.cs +++ b/LethalLevelLoader/General/Patches.cs @@ -656,10 +656,13 @@ internal static void RoundManagerSpawnOutsideHazards_Prefix() [HarmonyPostfix] internal static void RoundManagerFinishGeneratingNewLevelClientRpc_Prefix() { - LevelLoader.RefreshFootstepSurfaces(); - LevelLoader.BakeSceneColliderMaterialData(RoundManager.dungeonGenerator.gameObject.scene); - if (LevelLoader.vanillaWaterShader != null) - LevelLoader.TryRestoreWaterShaders(RoundManager.dungeonGenerator.gameObject.scene); + if (TimeOfDay.sunAnimator != null) + { + LevelLoader.RefreshFootstepSurfaces(); + LevelLoader.BakeSceneColliderMaterialData(TimeOfDay.sunAnimator.gameObject.scene); + if (LevelLoader.vanillaWaterShader != null) + LevelLoader.TryRestoreWaterShaders(TimeOfDay.sunAnimator.gameObject.scene); + } } /* diff --git a/LethalLevelLoader/Loaders/LevelLoader.cs b/LethalLevelLoader/Loaders/LevelLoader.cs index 333e68b..dae089f 100644 --- a/LethalLevelLoader/Loaders/LevelLoader.cs +++ b/LethalLevelLoader/Loaders/LevelLoader.cs @@ -190,9 +190,14 @@ public static bool TryGetFootstepSurface(Collider collider, out FootstepSurface { footstepSurface = null; + if (collider == null) + return (false); + if (cachedLevelColliderMaterialDictionary.TryGetValue(collider, out List materials)) - foreach (Material material in materials) - activeExtendedFootstepSurfaceDictionary.TryGetValue(material.name, out footstepSurface); + if (materials != null) + foreach (Material material in materials) + if (material != null && !string.IsNullOrEmpty(material.name)) + activeExtendedFootstepSurfaceDictionary.TryGetValue(material.name, out footstepSurface); return (footstepSurface != null); } diff --git a/LethalLevelLoader/Plugin.cs b/LethalLevelLoader/Plugin.cs index a2f2463..90f9875 100644 --- a/LethalLevelLoader/Plugin.cs +++ b/LethalLevelLoader/Plugin.cs @@ -24,7 +24,7 @@ public class Plugin : BaseUnityPlugin { public const string ModGUID = "imabatby.lethallevelloader"; public const string ModName = "LethalLevelLoader"; - public const string ModVersion = "1.3.6"; + public const string ModVersion = "1.3.7"; internal static Plugin Instance;