From 45858f2dd2a5ba53f713e593a499ecb859b7345a Mon Sep 17 00:00:00 2001 From: Markus Rathgeb Date: Thu, 21 Feb 2019 09:13:54 +0000 Subject: [PATCH] model.core: respect OSGi lifecycle (#592) Fixes: https://github.com/openhab/openhab-core/issues/591 Signed-off-by: Markus Rathgeb --- .../model/core/internal/folder/FolderObserver.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.core.model.core/src/main/java/org/eclipse/smarthome/model/core/internal/folder/FolderObserver.java b/bundles/org.openhab.core.model.core/src/main/java/org/eclipse/smarthome/model/core/internal/folder/FolderObserver.java index e1d5751a7..f2c3839e9 100644 --- a/bundles/org.openhab.core.model.core/src/main/java/org/eclipse/smarthome/model/core/internal/folder/FolderObserver.java +++ b/bundles/org.openhab.core.model.core/src/main/java/org/eclipse/smarthome/model/core/internal/folder/FolderObserver.java @@ -98,8 +98,10 @@ public class FolderObserver extends AbstractWatchService { protected void removeModelParser(ModelParser modelParser) { parsers.remove(modelParser.getExtension()); - Set removed = modelRepo.removeAllModelsOfType(modelParser.getExtension()); - ignoredFiles.addAll(removed.stream().map(name -> nameFileMap.get(name)).collect(Collectors.toSet())); + if (modelRepo != null) { + Set removed = modelRepo.removeAllModelsOfType(modelParser.getExtension()); + ignoredFiles.addAll(removed.stream().map(name -> nameFileMap.get(name)).collect(Collectors.toSet())); + } } @Activate