Fix NPEs for failed stores

This commit is contained in:
crschnick 2023-06-22 19:08:11 +00:00
parent a2364d6f47
commit 569e262c97
2 changed files with 15 additions and 0 deletions

View file

@ -7,6 +7,7 @@ import io.xpipe.app.fxcomps.SimpleComp;
import io.xpipe.app.fxcomps.impl.IconButtonComp;
import io.xpipe.app.fxcomps.impl.PrettyImageComp;
import io.xpipe.app.fxcomps.util.PlatformThread;
import io.xpipe.app.storage.DataStoreEntry;
import io.xpipe.app.util.BusyProperty;
import io.xpipe.app.util.ThreadHelper;
import io.xpipe.core.store.DataStore;
@ -177,6 +178,15 @@ final class BrowserBookmarkList extends SimpleComp {
setAccessibleText(null);
} else {
setText(item.getName());
// Check if store is in failed state
if (item.getEntry().getState() == DataStoreEntry.State.LOAD_FAILED) {
setGraphic(null);
setFocusTraversable(false);
setAccessibleText(null);
return;
}
img.set(item.getEntry()
.getProvider()
.getDisplayIconFileName(item.getEntry().getStore()));

View file

@ -112,6 +112,11 @@ public class DataStoreChoiceComp<T extends DataStore> extends SimpleComp {
continue;
}
// Check if load failed
if (e.getEntry().getStore() == null) {
continue;
}
var node = comboBox.add((T) e.getEntry().getStore());
if (!storeClass.isAssignableFrom(s.getClass()) || !applicableCheck.test((T) s)) {
comboBox.disable(node);