https://issues.apache.org/jira/browse/AMQ-5051

fix potential NPE