diff --git a/RasterPropMonitor/Core/RasterPropMonitor.cs b/RasterPropMonitor/Core/RasterPropMonitor.cs index a8410907..2dafee0b 100644 --- a/RasterPropMonitor/Core/RasterPropMonitor.cs +++ b/RasterPropMonitor/Core/RasterPropMonitor.cs @@ -310,8 +310,11 @@ public void OnDestroy() { Destroy(screenMat); } - rpmComp.UnregisterResourceCallback(resourceName, ResourceDepletedCallback); - rpmComp.UnregisterVariableCallback("COMMNETVESSELCONTROLSTATE", CommConnectionCallback); + if (rpmComp != null) + { + rpmComp.UnregisterResourceCallback(resourceName, ResourceDepletedCallback); + rpmComp.UnregisterVariableCallback("COMMNETVESSELCONTROLSTATE", CommConnectionCallback); + } } private static void PlayClickSound(FXGroup audioOutput)