Make store creation more resilient when parent is deleted

This commit is contained in:
crschnick 2024-03-12 15:27:30 +00:00
parent a4faa7c04c
commit 0b0e92e9da

View file

@ -115,7 +115,7 @@ public class StoreCreationComp extends DialogComp {
DataStorage.get().getSelectedCategory().getUuid(), DataStorage.get().getSelectedCategory().getUuid(),
name.getValue(), name.getValue(),
store.getValue()); store.getValue());
var p = provider.getValue().getDisplayParent(testE); var p = DataStorage.get().getDefaultDisplayParent(testE).orElse(null);
var targetCategory = p != null var targetCategory = p != null
? p.getCategoryUuid() ? p.getCategoryUuid()
@ -271,6 +271,11 @@ public class StoreCreationComp extends DialogComp {
} }
ThreadHelper.runAsync(() -> { ThreadHelper.runAsync(() -> {
// Might have changed since last time
if (entry.getValue() == null) {
return;
}
try (var b = new BooleanScope(busy).start()) { try (var b = new BooleanScope(busy).start()) {
DataStorage.get().addStoreEntryInProgress(entry.getValue()); DataStorage.get().addStoreEntryInProgress(entry.getValue());
entry.getValue().validateOrThrow(); entry.getValue().validateOrThrow();