From d64a9d9029e20169cb215c1084cdb47bc5833643 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 12 Jan 2021 09:41:46 +0100 Subject: [PATCH] [xdata] Fix NPE in DataForm.Builder.addItem() Fixes SMACK-900. --- .../java/org/jivesoftware/smackx/xdata/packet/DataForm.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java index d56214d31..0457e69f3 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java @@ -494,6 +494,9 @@ public final class DataForm implements ExtensionElement { * @return a reference to this builder. */ public Builder addItem(Item item) { + if (items == null) { + items = new ArrayList<>(); + } items.add(item); return this; }