Commit 696fd54d authored by Tom Evans's avatar Tom Evans

Fix NPE when handling routing failures

Avoids NPE by dropping (and optionally logging) error response stanzas
if the original packet has no sender JID.
parent 82e13c81
...@@ -433,6 +433,12 @@ public class IQRouter extends BasicModule { ...@@ -433,6 +433,12 @@ public class IQRouter extends BasicModule {
Log.error("Cannot reply an IQ error to another IQ error: " + originalPacket.toXML()); Log.error("Cannot reply an IQ error to another IQ error: " + originalPacket.toXML());
return; return;
} }
if (originalPacket.getFrom() == null) {
if (Log.isDebugEnabled()) {
Log.debug("Original IQ has no sender for reply; dropped: " + originalPacket.toXML());
}
return;
}
IQ reply = IQ.createResultIQ(originalPacket); IQ reply = IQ.createResultIQ(originalPacket);
reply.setChildElement(originalPacket.getChildElement().createCopy()); reply.setChildElement(originalPacket.getChildElement().createCopy());
reply.setError(condition); reply.setError(condition);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment