Fix NPE when handling alarm delete notification for cleared alarm

This commit is contained in:
Viacheslav Klimov 2022-05-04 11:47:41 +03:00
parent b619ffa6b7
commit 3098b2925a

View File

@ -197,7 +197,8 @@ class DeviceState {
private void processAlarmDeleteNotification(TbContext ctx, TbMsg msg) {
Alarm alarm = JacksonUtil.fromString(msg.getData(), Alarm.class);
alarmStates.values().removeIf(alarmState -> alarmState.getCurrentAlarm().getId().equals(alarm.getId()));
alarmStates.values().removeIf(alarmState -> alarmState.getCurrentAlarm() != null
&& alarmState.getCurrentAlarm().getId().equals(alarm.getId()));
ctx.tellSuccess(msg);
}