Avoid NullPointerException when jms destination is not available (#11570)

This commit is contained in:
Lauri Tulmin 2024-06-13 09:54:14 +03:00 committed by GitHub
parent f533bf31f5
commit 55e723e810
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 5 deletions

View File

@ -31,11 +31,13 @@ public abstract class MessageWithDestination {
jmsDestination = fallbackDestination; jmsDestination = fallbackDestination;
} }
if (jmsDestination.isQueue()) { if (jmsDestination != null) {
return createMessageWithQueue(message, jmsDestination); if (jmsDestination.isQueue()) {
} return createMessageWithQueue(message, jmsDestination);
if (jmsDestination.isTopic()) { }
return createMessageWithTopic(message, jmsDestination); if (jmsDestination.isTopic()) {
return createMessageWithTopic(message, jmsDestination);
}
} }
return new AutoValue_MessageWithDestination( return new AutoValue_MessageWithDestination(
message, "unknown", /* isTemporaryDestination= */ false); message, "unknown", /* isTemporaryDestination= */ false);