Commit a3d2eb4c4e69da5e7490a18b696e835a7c915ceb
1 parent
76bb8f13
Fix NPE in entity data subscription
Showing
2 changed files
with
4 additions
and
2 deletions
@@ -302,7 +302,9 @@ public class DefaultTbEntityDataSubscriptionService implements TbEntityDataSubsc | @@ -302,7 +302,9 @@ public class DefaultTbEntityDataSubscriptionService implements TbEntityDataSubsc | ||
302 | Map<Integer, TbAbstractDataSubCtx> sessionSubs = subscriptionsBySessionId.computeIfAbsent(sessionRef.getSessionId(), k -> new HashMap<>()); | 302 | Map<Integer, TbAbstractDataSubCtx> sessionSubs = subscriptionsBySessionId.computeIfAbsent(sessionRef.getSessionId(), k -> new HashMap<>()); |
303 | TbEntityDataSubCtx ctx = new TbEntityDataSubCtx(serviceId, wsService, entityService, localSubscriptionService, | 303 | TbEntityDataSubCtx ctx = new TbEntityDataSubCtx(serviceId, wsService, entityService, localSubscriptionService, |
304 | attributesService, stats, sessionRef, cmd.getCmdId(), maxEntitiesPerDataSubscription); | 304 | attributesService, stats, sessionRef, cmd.getCmdId(), maxEntitiesPerDataSubscription); |
305 | - ctx.setAndResolveQuery(cmd.getQuery()); | 305 | + if (cmd.getQuery() != null) { |
306 | + ctx.setAndResolveQuery(cmd.getQuery()); | ||
307 | + } | ||
306 | sessionSubs.put(cmd.getCmdId(), ctx); | 308 | sessionSubs.put(cmd.getCmdId(), ctx); |
307 | return ctx; | 309 | return ctx; |
308 | } | 310 | } |
@@ -107,7 +107,7 @@ public abstract class TbAbstractDataSubCtx<T extends AbstractDataQuery<? extends | @@ -107,7 +107,7 @@ public abstract class TbAbstractDataSubCtx<T extends AbstractDataQuery<? extends | ||
107 | public void setAndResolveQuery(T query) { | 107 | public void setAndResolveQuery(T query) { |
108 | dynamicValues.clear(); | 108 | dynamicValues.clear(); |
109 | this.query = query; | 109 | this.query = query; |
110 | - if (query.getKeyFilters() != null) { | 110 | + if (query != null && query.getKeyFilters() != null) { |
111 | for (KeyFilter filter : query.getKeyFilters()) { | 111 | for (KeyFilter filter : query.getKeyFilters()) { |
112 | registerDynamicValues(filter.getPredicate()); | 112 | registerDynamicValues(filter.getPredicate()); |
113 | } | 113 | } |