fix: prevent NPE when loading state with null conversations

This commit is contained in:
Carl-Robert Linnupuu 2025-07-04 12:59:46 +01:00
parent 74e508cb38
commit 4330a090d8

View file

@ -47,6 +47,10 @@ public class ConversationsState implements PersistentStateComponent<Conversation
public void loadState(@NotNull ConversationsState state) {
XmlSerializerUtil.copyBean(state, this);
if (this.conversations == null) {
this.conversations = new ArrayList<>();
}
conversationsContainer.getConversationsMapping().values().stream()
.flatMap(Collection::stream)
.sorted(Comparator.comparing(Conversation::getUpdatedOn).reversed())