mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 07:02:02 +01:00
Fix NullPointerException (#18034)
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
7cc9903158
commit
8a3baf8003
@ -18,6 +18,7 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -87,7 +88,7 @@ public class EnOceanBaseSensorHandler extends EnOceanBaseThingHandler implements
|
|||||||
config.receivingEEPId.forEach(receivingEEP -> {
|
config.receivingEEPId.forEach(receivingEEP -> {
|
||||||
EEPType receivingEEPType = EEPType.getType(receivingEEP);
|
EEPType receivingEEPType = EEPType.getType(receivingEEP);
|
||||||
EEPType existingKey = receivingEEPTypes.putIfAbsent(receivingEEPType.getRORG(), receivingEEPType);
|
EEPType existingKey = receivingEEPTypes.putIfAbsent(receivingEEPType.getRORG(), receivingEEPType);
|
||||||
if (existingKey != null) {
|
if (!Objects.isNull(existingKey)) {
|
||||||
throw new IllegalArgumentException("Receiving more than one EEP of the same RORG is not supported");
|
throw new IllegalArgumentException("Receiving more than one EEP of the same RORG is not supported");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -155,6 +156,9 @@ public class EnOceanBaseSensorHandler extends EnOceanBaseThingHandler implements
|
|||||||
ERP1Message msg = (ERP1Message) packet;
|
ERP1Message msg = (ERP1Message) packet;
|
||||||
|
|
||||||
EEPType localReceivingType = receivingEEPTypes.get(msg.getRORG());
|
EEPType localReceivingType = receivingEEPTypes.get(msg.getRORG());
|
||||||
|
if (Objects.isNull(localReceivingType)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
EEP eep = EEPFactory.buildEEP(localReceivingType, (ERP1Message) packet);
|
EEP eep = EEPFactory.buildEEP(localReceivingType, (ERP1Message) packet);
|
||||||
logger.debug("ESP Packet payload {} for {} received", HexUtils.bytesToHex(packet.getPayload()),
|
logger.debug("ESP Packet payload {} for {} received", HexUtils.bytesToHex(packet.getPayload()),
|
||||||
|
Loading…
Reference in New Issue
Block a user