From 235f62ffc7aa08bb78c79911a53af238e4c3dd42 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 14 Sep 2022 21:33:41 -0400 Subject: [PATCH] null check ig idk why a required mod wouldn't be downloaded --- .../CommonCameraUtility/CommonCameraHandler.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/NewHorizons/OtherMods/CommonCameraUtility/CommonCameraHandler.cs b/NewHorizons/OtherMods/CommonCameraUtility/CommonCameraHandler.cs index 2aab1526..e344a57f 100644 --- a/NewHorizons/OtherMods/CommonCameraUtility/CommonCameraHandler.cs +++ b/NewHorizons/OtherMods/CommonCameraUtility/CommonCameraHandler.cs @@ -1,4 +1,5 @@ using NewHorizons.OtherMods.MenuFramework; +using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.OtherMods.CommonCameraUtility { @@ -11,6 +12,16 @@ namespace NewHorizons.OtherMods.CommonCameraUtility _cameraAPI = Main.Instance.ModHelper.Interaction.TryGetModApi("xen.CommonCameraUtility"); } - public static void RegisterCustomCamera(OWCamera camera) => _cameraAPI.RegisterCustomCamera(camera); + public static void RegisterCustomCamera(OWCamera camera) + { + if (_cameraAPI != null) + { + _cameraAPI.RegisterCustomCamera(camera); + } + else + { + Logger.LogError("Tried to register custom camera but Common Camera Utility was missing."); + } + } } }