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

Fix the NPE case