NO-JIRA Check data != null during encode

Picked up by code analysis checks
This commit is contained in:
Michael André Pearce 2019-01-18 00:47:24 +00:00
parent 82ab6ff159
commit 07fa93dfae
1 changed files with 3 additions and 3 deletions

View File

@ -815,13 +815,13 @@ public class AMQPMessage extends RefCountMessage {
encoder.writeObject(applicationProperties);
// Now raw write the remainder body and footer if present.
if (remainingBodyPosition != VALUE_NOT_PRESENT) {
if (data != null && remainingBodyPosition != VALUE_NOT_PRESENT) {
writable.put(data.position(remainingBodyPosition));
}
} else if (applicationPropertiesPosition != VALUE_NOT_PRESENT) {
} else if (data != null && applicationPropertiesPosition != VALUE_NOT_PRESENT) {
// Writes out ApplicationProperties, Body and Footer in one go if present.
writable.put(data.position(applicationPropertiesPosition));
} else if (remainingBodyPosition != VALUE_NOT_PRESENT) {
} else if (data != null && remainingBodyPosition != VALUE_NOT_PRESENT) {
// No Application properties at all so raw write Body and Footer sections
writable.put(data.position(remainingBodyPosition));
}