-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Was this bug identified in a specific build version?
Essentials 1.16.0-rc-2374
Describe the bug
Attempting to invoke UsageTracker.StartDeviceUsage() on a source with "type": "laptop" will cause a null exception.
Stacktrace
Include a stack trace of the exception if possible.
Error: SimplSharpPro.exe [App 1] # 2024-02-06 12:50:22 # Exception:BeginInvoke- Unhandled exception: - System.NullReferenceException: NullReferenceException
at PepperDash.Essentials.Plugin.Room.RoomController.<>c__DisplayClass18.<RunRouteAction>b__17(Object o)
at Crestron.SimplSharp.UserThreadStartDeleg 12. Error: SimplSharpPro.exe [App 1] # 2024-02-06 12:50:22 # ateWrapper.a(Object A_0)
at System.Threading.Timer.ring()
To Reproduce
Steps to reproduce the behavior:
- Load system using Essentials Room (or api-room) with a source using the configuration:
{
"key": "laptop-1",
"name": "HDMI 1",
"type": "laptop",
"group": "pc",
"uid": 7,
"id": "24db1d75-9444-45e0-b105-0fdf422dcbef",
"properties": {
"isDefault": false
}
}
- Routing the source using the
RunRouteActionmethod will attempt to start the device usage tracker, causing the null reference exception.
Additional context
Added a null reference check on the UsageTracker to RunRouteAction to prevent the exception:
// Start usage timer on routed source
if (sourceListItem.SourceDevice is IUsageTracking && (sourceListItem.SourceDevice as IUsageTracking).UsageTracker != null)
{
(sourceListItem.SourceDevice as IUsageTracking).UsageTracker.StartDeviceUsage();
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working