From 99038aa332f4520b628b721b4b63c7e9f21080a8 Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 8 Aug 2023 10:25:02 -0400 Subject: [PATCH] Added null check for null pointer exception --- .../ambassador/InfrastructureMessageAmbassador.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/co-simulation/fed/mosaic-infrastructure/src/main/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureMessageAmbassador.java b/co-simulation/fed/mosaic-infrastructure/src/main/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureMessageAmbassador.java index 10a2c3af..7db5cfd1 100644 --- a/co-simulation/fed/mosaic-infrastructure/src/main/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureMessageAmbassador.java +++ b/co-simulation/fed/mosaic-infrastructure/src/main/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureMessageAmbassador.java @@ -302,7 +302,10 @@ public synchronized void processTimeAdvanceGrant(long time) throws InternalFeder onRsuRegistrationRequest(reg.getInfrastructureId(), reg.getLocation().toGeo()); log.info("RSU Registration for "+ reg.getInfrastructureId() + " @ x, y, z: (" + reg.getLocation().getX() + ", " + reg.getLocation().getY() + ", " + reg.getLocation().getZ() + ")"); onDsrcRegistrationRequest(reg.getInfrastructureId()); - log.debug("Sending SensorRegistration interactions for sensor : {}", reg.getSensors()); + // Check for empty list of sensors which is valid + if (reg.getSensors() != null ) { + log.debug("Sending SensorRegistration interactions for sensor : {}", reg.getSensors()); + } for (Detector sensor : reg.getSensors()) { // Trigger Sensor registrations for all listed sensors. this.rti.triggerInteraction(new DetectorRegistration(time,sensor));