[avmfritz] Fix NPE when Fritz!Box sends empty alert state element (<state/>) (#15479)

Signed-off-by: Ulrich Mertin <mail@ulrich-mertin.de>
pull/15445/head
quidam 2023-09-02 19:20:50 +02:00 committed by GitHub
parent b9a0e6fa14
commit 38d45ca017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -42,15 +42,15 @@ public class AlertModel {
}
public boolean hasObstructionAlarmOccurred() {
return (state.intValue() & 1) != 0;
return state != null && (state.intValue() & 1) != 0;
}
public boolean hasTemperaturAlarmOccurred() {
return (state.intValue() & 2) != 0;
return state != null && (state.intValue() & 2) != 0;
}
public boolean hasUnknownAlarmOccurred() {
return ((state.intValue() & 255) >> 2) != 0;
return state != null && ((state.intValue() & 255) >> 2) != 0;
}
@Override