From e26240ac1fcc35c3738ef1fd0176289b064b8f52 Mon Sep 17 00:00:00 2001 From: crschnick Date: Mon, 1 Jul 2024 15:08:01 +0000 Subject: [PATCH] Make store wrapper more resilient --- .../app/comp/store/StoreEntryWrapper.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java b/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java index da7a84e00..37b40b2f2 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java @@ -151,7 +151,7 @@ public class StoreEntryWrapper { summary.setValue(null); } else { try { - summary.setValue(entry.getProvider().summaryString(this)); + summary.setValue(entry.getProvider() != null ? entry.getProvider().summaryString(this) : null); } catch (Exception ex) { // Summary creation might fail or have a bug ErrorEvent.fromThrowable(ex).handle(); @@ -162,18 +162,18 @@ public class StoreEntryWrapper { actionProviders.clear(); defaultActionProvider.setValue(null); } else { - var defaultProvider = ActionProvider.ALL.stream() - .filter(e -> entry.getStore() != null - && e.getDefaultDataStoreCallSite() != null - && e.getDefaultDataStoreCallSite() - .getApplicableClass() - .isAssignableFrom(entry.getStore().getClass()) - && e.getDefaultDataStoreCallSite().isApplicable(entry.ref())) - .findFirst() - .orElse(null); - this.defaultActionProvider.setValue(defaultProvider); - try { + var defaultProvider = ActionProvider.ALL.stream() + .filter(e -> entry.getStore() != null + && e.getDefaultDataStoreCallSite() != null + && e.getDefaultDataStoreCallSite() + .getApplicableClass() + .isAssignableFrom(entry.getStore().getClass()) + && e.getDefaultDataStoreCallSite().isApplicable(entry.ref())) + .findFirst() + .orElse(null); + this.defaultActionProvider.setValue(defaultProvider); + var newProviders = ActionProvider.ALL.stream() .filter(dataStoreActionProvider -> { return showActionProvider(dataStoreActionProvider);