Skip to content

Calling DeleteAlarm while that alarm's window is open creates a harmless NRE #253

@Clayell

Description

@Clayell

Ran into this issue while testing KSP-RO/RP-1#2618 and calling DeleteAlarm. This log is generated:

(for this specific usecase, the alarm is deleted very quickly after being triggered)

9/24/2025 6:01:46 PM, KerbalAlarm Clock, Triggering Alarm - RP-1: Satellite Era Science Complete
9/24/2025 6:01:46 PM, KerbalAlarm Clock, RP-1: Satellite Era Science Complete-Halt Warp
9/24/2025 6:01:46 PM, KerbalAlarm Clock, Actioning Alarm
9/24/2025 6:01:46 PM, KerbalAlarm Clock, API-DeleteAlarm-
Deleting:08a4bc047342422497c27f413a6bbfc6
[EXC 18:01:46.539] NullReferenceException: Object reference not set to an instance of an object
    KerbalAlarmClock.KerbalAlarmClock.FillAlarmWindow (System.Int32 windowID) (at <d69ce5a979e54db99b605106fabdee09>:0)
    UnityEngine.GUILayout+LayoutedWindow.DoWindow (System.Int32 windowID) (at <58f888e0d56a4620958c8e58a768c70d>:0)
    UnityEngine.GUI.CallWindowDelegate (UnityEngine.GUI+WindowFunction func, System.Int32 id, System.Int32 instanceID, UnityEngine.GUISkin _skin, System.Int32 forceRect, System.Single width, System.Single height, UnityEngine.GUIStyle style) (at <58f888e0d56a4620958c8e58a768c70d>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)

Calling the stock AlarmClockScenario.DeleteAlarm method while a stock alarm window is open doesn't cause any issues, KSP just seems to handle it, so this is a (slight) regression from stock. The NRE doesn't seem to cause anything to break, the alarm window closes fine afterwards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions