diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java index 805b5218a6..b5b6279ac6 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java @@ -878,7 +878,9 @@ public class MessageDatabase implements BrokerServiceAware { Long sequenceId = sd.messageIdIndex.remove(tx, command.getMessageId()); if (sequenceId != null) { MessageKeys keys = sd.orderIndex.remove(tx, sequenceId); - sd.locationIndex.remove(tx, keys.location); + if (keys != null) { + sd.locationIndex.remove(tx, keys.location); + } } } else { // In the topic case we need remove the message once it's been acked