diff --git a/src/main/java/com/sparrowwallet/drongo/protocol/TransactionInput.java b/src/main/java/com/sparrowwallet/drongo/protocol/TransactionInput.java index 92f12ba..3cef84e 100644 --- a/src/main/java/com/sparrowwallet/drongo/protocol/TransactionInput.java +++ b/src/main/java/com/sparrowwallet/drongo/protocol/TransactionInput.java @@ -101,9 +101,10 @@ public class TransactionInput extends ChildMessage { } public void setWitness(TransactionWitness witness) { + int newLength = witness != null ? witness.getLength() : 0; int existingLength = getWitness() != null ? getWitness().getLength() : 0; if(getParent() != null) { - getParent().adjustLength(witness.getLength() - existingLength); + getParent().adjustLength(newLength - existingLength); } this.witness = witness;