From 860ae0ee60a41167e3d96a6085784d921617592d Mon Sep 17 00:00:00 2001 From: crschnick Date: Sat, 10 Aug 2024 14:11:19 +0000 Subject: [PATCH] Fix NPE --- app/src/main/java/io/xpipe/app/storage/DataStorage.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/storage/DataStorage.java b/app/src/main/java/io/xpipe/app/storage/DataStorage.java index e4377c42e..a4a87d19b 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStorage.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStorage.java @@ -274,8 +274,11 @@ public abstract class DataStorage { public void updateEntry(DataStoreEntry entry, DataStoreEntry newEntry) { var state = entry.getStorePersistentState(); - var newState = state.mergeCopy(newEntry.getStorePersistentState()); - newEntry.setStorePersistentState(newState); + var nState = newEntry.getStorePersistentState(); + if (state != null && nState != null) { + var updatedState = state.mergeCopy(nState); + newEntry.setStorePersistentState(updatedState); + } var oldParent = DataStorage.get().getDefaultDisplayParent(entry); var newParent = DataStorage.get().getDefaultDisplayParent(newEntry);