Fixed NPE

This commit is contained in:
Christian Basler 2016-10-22 07:24:49 +02:00
parent 5cf6d308f2
commit a880a8c10b

View File

@ -198,6 +198,7 @@ public class Plaintext implements Streamable {
}
}
}
public void write(ByteBuffer buffer, boolean includeSignature) {
Encode.varInt(from.getVersion(), buffer);
Encode.varInt(from.getStream(), buffer);
@ -279,6 +280,7 @@ public class Plaintext implements Streamable {
}
public void updateNextTry() {
if (to != null) {
if (nextTry == null) {
if (sent != null && to.has(Feature.DOES_ACK)) {
nextTry = UnixTime.now(+ttl);
@ -289,6 +291,7 @@ public class Plaintext implements Streamable {
retries++;
}
}
}
public String getSubject() {
Scanner s = new Scanner(new ByteArrayInputStream(message), "UTF-8");
@ -323,7 +326,7 @@ public class Plaintext implements Streamable {
Objects.equals(from, plaintext.from) &&
Arrays.equals(message, plaintext.message) &&
Objects.equals(getAckMessage(), plaintext.getAckMessage()) &&
Arrays.equals(to.getRipe(), plaintext.to.getRipe()) &&
Arrays.equals(to == null ? null : to.getRipe(), plaintext.to == null ? null : plaintext.to.getRipe()) &&
Arrays.equals(signature, plaintext.signature) &&
Objects.equals(status, plaintext.status) &&
Objects.equals(sent, plaintext.sent) &&