Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

AgentService null checks for protocol

Rich Turner2c708c80f2c5
diff --git a/manager/server/src/main/java/org/openremote/manager/server/agent/AgentService.java b/manager/server/src/main/java/org/openremote/manager/server/agent/AgentService.java
index 91e84476a..8ff57773b 100644
--- a/manager/server/src/main/java/org/openremote/manager/server/agent/AgentService.java
+++ b/manager/server/src/main/java/org/openremote/manager/server/agent/AgentService.java
@@ -345,6 +345,11 @@ public class AgentService extends RouteBuilder implements ContainerService, Cons
}
protected void linkAttributes(Protocol protocol, List<ThingAttribute> attributes) {
+ if (protocol == null) {
+ LOG.severe("Cannot link protocol attributes as protocol is null");
+ return;
+ }
+
try {
LOG.finest("Linking protocol attributes to: " + protocol.getProtocolName());
protocol.linkAttributes(attributes);
@@ -355,6 +360,11 @@ public class AgentService extends RouteBuilder implements ContainerService, Cons
}
protected void unlinkAttributes(Protocol protocol, List<ThingAttribute> attributes) {
+ if (protocol == null) {
+ LOG.severe("Cannot link protocol attributes as protocol is null");
+ return;
+ }
+
try {
LOG.finest("Unlinking protocol attributes form: " + protocol.getProtocolName());
protocol.unlinkAttributes(attributes);