mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 11:45:49 +01:00
prevent NPEs if persistence service does not play nice (#426)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
parent
24d32f877c
commit
511a1e4d9f
@ -46,23 +46,25 @@ public class QueryablePersistenceServiceDelegate extends PersistenceServiceDeleg
|
||||
org.openhab.core.persistence.QueryablePersistenceService pService = (org.openhab.core.persistence.QueryablePersistenceService) service;
|
||||
Iterable<org.openhab.core.persistence.HistoricItem> historicItems = pService.query(mappedFilter);
|
||||
ArrayList<HistoricItem> 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user