Skip to content

Commit 48552ac

Browse files
authored
Merge pull request #221 from Resgrid/develop
CU-868d85dv8 More worker fix
2 parents d69a976 + 410861e commit 48552ac

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

Core/Resgrid.Services/NotificationService.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff 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
{

0 commit comments

Comments
 (0)