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 | 302 | Map<Integer, TbAbstractDataSubCtx> sessionSubs = subscriptionsBySessionId.computeIfAbsent(sessionRef.getSessionId(), k -> new HashMap<>()); |
303 | 303 | TbEntityDataSubCtx ctx = new TbEntityDataSubCtx(serviceId, wsService, entityService, localSubscriptionService, |
304 | 304 | attributesService, stats, sessionRef, cmd.getCmdId(), maxEntitiesPerDataSubscription); |
305 | - ctx.setAndResolveQuery(cmd.getQuery()); | |
305 | + if (cmd.getQuery() != null) { | |
306 | + ctx.setAndResolveQuery(cmd.getQuery()); | |
307 | + } | |
306 | 308 | sessionSubs.put(cmd.getCmdId(), ctx); |
307 | 309 | return ctx; |
308 | 310 | } | ... | ... |
... | ... | @@ -107,7 +107,7 @@ public abstract class TbAbstractDataSubCtx<T extends AbstractDataQuery<? extends |
107 | 107 | public void setAndResolveQuery(T query) { |
108 | 108 | dynamicValues.clear(); |
109 | 109 | this.query = query; |
110 | - if (query.getKeyFilters() != null) { | |
110 | + if (query != null && query.getKeyFilters() != null) { | |
111 | 111 | for (KeyFilter filter : query.getKeyFilters()) { |
112 | 112 | registerDynamicValues(filter.getPredicate()); |
113 | 113 | } | ... | ... |