diff --git a/src/main/java/com/sparrowwallet/hummingbird/fountain/FountainDecoder.java b/src/main/java/com/sparrowwallet/hummingbird/fountain/FountainDecoder.java index 59b11e7..9f01662 100644 --- a/src/main/java/com/sparrowwallet/hummingbird/fountain/FountainDecoder.java +++ b/src/main/java/com/sparrowwallet/hummingbird/fountain/FountainDecoder.java @@ -30,7 +30,7 @@ public class FountainDecoder { private final List queuedParts = new ArrayList<>(); public int getExpectedPartCount() { - return expectedPartIndexes.size(); + return expectedPartIndexes == null ? 0 : expectedPartIndexes.size(); } public Set getRecievedPartIndexes() { @@ -46,6 +46,10 @@ public class FountainDecoder { } public double getEstimatedPercentComplete() { + if(processedPartsCount == 0) { + return 0d; + } + double estimatedInputParts = (double)getExpectedPartCount() * 1.75; return Math.min(0.99, (double)processedPartsCount / estimatedInputParts); }