File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -455,19 +455,31 @@ public async Task<DepartmentGroup> GetGroupForEventAsync(ProcessedNotification n
455455 if ( notification . Type == EventTypes . UnitStatusChanged )
456456 {
457457 var unitEvent = await _unitsService . GetUnitStateByIdAsync ( dynamicData . StateId ) ;
458- return await _departmentGroupsService . GetGroupByIdAsync ( unitEvent . Unit . StationGroupId . GetValueOrDefault ( ) ) ;
458+
459+ if ( unitEvent != null )
460+ {
461+ return await _departmentGroupsService . GetGroupByIdAsync ( unitEvent . Unit . StationGroupId . GetValueOrDefault ( ) ) ;
462+ }
459463 }
460464 else if ( notification . Type == EventTypes . PersonnelStatusChanged )
461465 {
462466 var userStaffing = await _userStateService . GetUserStateByIdAsync ( dynamicData . StateId ) ;
463- var group = await _departmentGroupsService . GetGroupForUserAsync ( userStaffing . UserId , notification . DepartmentId ) ;
464- return group ;
467+
468+ if ( userStaffing != null )
469+ {
470+ var group = await _departmentGroupsService . GetGroupForUserAsync ( userStaffing . UserId , notification . DepartmentId ) ;
471+ return group ;
472+ }
465473 }
466474 else if ( notification . Type == EventTypes . PersonnelStatusChanged )
467475 {
468476 var actionLog = await _actionLogsService . GetActionLogByIdAsync ( dynamicData . StateId ) ;
469- var group = await _departmentGroupsService . GetGroupForUserAsync ( actionLog . UserId , notification . DepartmentId ) ;
470- return group ;
477+
478+ if ( actionLog != null )
479+ {
480+ var group = await _departmentGroupsService . GetGroupForUserAsync ( actionLog . UserId , notification . DepartmentId ) ;
481+ return group ;
482+ }
471483 }
472484 else if ( notification . Type == EventTypes . UserAssignedToGroup )
473485 {
You can’t perform that action at this time.
0 commit comments