Skip to content

Commit

Permalink
Fix NullPointerException (#18034)
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
  • Loading branch information
jlaur authored Jan 4, 2025
1 parent 7cc9903 commit 8a3baf8
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.Hashtable;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -87,7 +88,7 @@ boolean validateConfig() {
config.receivingEEPId.forEach(receivingEEP -> {
EEPType receivingEEPType = EEPType.getType(receivingEEP);
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");
}
});
Expand Down Expand Up @@ -155,6 +156,9 @@ public void packetReceived(BasePacket packet) {
ERP1Message msg = (ERP1Message) packet;

EEPType localReceivingType = receivingEEPTypes.get(msg.getRORG());
if (Objects.isNull(localReceivingType)) {
return;
}

EEP eep = EEPFactory.buildEEP(localReceivingType, (ERP1Message) packet);
logger.debug("ESP Packet payload {} for {} received", HexUtils.bytesToHex(packet.getPayload()),
Expand Down

0 comments on commit 8a3baf8

Please sign in to comment.