1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +01:00

Fix NPE in ServiceDiscoveryManager

This commit is contained in:
Florian Schmaus 2020-03-09 14:41:52 +01:00
parent 00dd77b346
commit 863d0bf403
2 changed files with 9 additions and 1 deletions

View file

@ -162,6 +162,14 @@ public abstract class StanzaBuilder<B extends StanzaBuilder<B>> implements Stanz
return getThis();
}
public final B addOptExtensions(Collection<? extends ExtensionElement> extensionElements) {
if (extensionElements == null) {
return getThis();
}
return addExtensions(extensionElements);
}
public final B addExtensions(Collection<? extends ExtensionElement> extensionElements) {
for (ExtensionElement extensionElement : extensionElements) {
addExtension(extensionElement);

View file

@ -178,7 +178,7 @@ public final class ServiceDiscoveryManager extends Manager {
// Add node identities
responseBuilder.addIdentities(nodeInformationProvider.getNodeIdentities());
// Add packet extensions
responseBuilder.addExtensions(nodeInformationProvider.getNodePacketExtensions());
responseBuilder.addOptExtensions(nodeInformationProvider.getNodePacketExtensions());
} else {
// Return <item-not-found/> error since specified node was not found
responseBuilder.ofType(IQ.Type.error);