Skip to content

Commit d753d3c

Browse files
authored
Fix NRE if a MFD is destroyed in an internal that does not have a rpm computer
1 parent e48997b commit d753d3c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎RasterPropMonitor/Core/RasterPropMonitor.cs‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,11 @@ public void OnDestroy()
310310
{
311311
Destroy(screenMat);
312312
}
313-
rpmComp.UnregisterResourceCallback(resourceName, ResourceDepletedCallback);
314-
rpmComp.UnregisterVariableCallback("COMMNETVESSELCONTROLSTATE", CommConnectionCallback);
313+
if (rpmComp != null)
314+
{
315+
rpmComp.UnregisterResourceCallback(resourceName, ResourceDepletedCallback);
316+
rpmComp.UnregisterVariableCallback("COMMNETVESSELCONTROLSTATE", CommConnectionCallback);
317+
}
315318
}
316319

317320
private static void PlayClickSound(FXGroup audioOutput)

0 commit comments

Comments
 (0)