diff --git a/bundles/org.openhab.core.compat1x/src/main/java/org/openhab/core/persistence/internal/QueryablePersistenceServiceDelegate.java b/bundles/org.openhab.core.compat1x/src/main/java/org/openhab/core/persistence/internal/QueryablePersistenceServiceDelegate.java index 74ee116d9..69baf67c7 100644 --- a/bundles/org.openhab.core.compat1x/src/main/java/org/openhab/core/persistence/internal/QueryablePersistenceServiceDelegate.java +++ b/bundles/org.openhab.core.compat1x/src/main/java/org/openhab/core/persistence/internal/QueryablePersistenceServiceDelegate.java @@ -46,23 +46,25 @@ public class QueryablePersistenceServiceDelegate extends PersistenceServiceDeleg org.openhab.core.persistence.QueryablePersistenceService pService = (org.openhab.core.persistence.QueryablePersistenceService) service; Iterable historicItems = pService.query(mappedFilter); ArrayList result = new ArrayList<>(); - for (final org.openhab.core.persistence.HistoricItem item : historicItems) { - result.add(new HistoricItem() { - @Override - public Date getTimestamp() { - return item.getTimestamp(); - } + if (historicItems != null) { + for (final org.openhab.core.persistence.HistoricItem item : historicItems) { + result.add(new HistoricItem() { + @Override + public Date getTimestamp() { + return item.getTimestamp(); + } - @Override - public State getState() { - return (State) TypeMapper.mapToESHType(item.getState()); - } + @Override + public State getState() { + return (State) TypeMapper.mapToESHType(item.getState()); + } - @Override - public String getName() { - return item.getName(); - } - }); + @Override + public String getName() { + return item.getName(); + } + }); + } } return result; }