Fix RabbitMq NPE case (#2450)

* Fix npe
This commit is contained in:
于玉桔 2019-04-05 09:52:33 +08:00 committed by 吴晟 Wu Sheng
parent 128a119077
commit ea566b19a5
1 changed files with 5 additions and 1 deletions

View File

@ -51,7 +51,11 @@ public class RabbitMQConsumerInterceptor implements InstanceMethodsAroundInterce
CarrierItem next = contextCarrier.items();
while (next.hasNext()) {
next = next.next();
next.setHeadValue(properties.getHeaders().get(next.getHeadKey()).toString());
if (properties.getHeaders() != null && properties.getHeaders().get(next.getHeadKey()) != null) {
next.setHeadValue(properties.getHeaders().get(next.getHeadKey()).toString());
} else {
next.setHeadValue("");
}
}
ContextManager.extract(contextCarrier);