Skip to content

Commit

Permalink
harden possible NPE on update progress Reader.java:282
Browse files Browse the repository at this point in the history
  • Loading branch information
de-luxe committed Jun 2, 2018
1 parent fa9874e commit 2fd231b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/burstcoin/jminer/core/reader/Reader.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public void handleMessage(ReaderLoadedPartEvent event)
// update progress
Long removedCapacity = capacityLookup.remove(event.getChunkPartStartNonce());
Long realRemovedCapacity = realCapacityLookup.remove(event.getChunkPartStartNonce());
if(removedCapacity != null)
if(removedCapacity != null && realRemovedCapacity != null)
{
remainingCapacity -= removedCapacity;
realRemainingCapacity -= realRemovedCapacity;
Expand All @@ -286,8 +286,8 @@ public void handleMessage(ReaderLoadedPartEvent event)
}
else
{
LOG.error("Error: ReaderPartLoadedEvent for unknown chunkPartStartNonce: '" + event.getChunkPartStartNonce() + "'!"
+ " Please check for plot-file duplicate or overlapping plots.");
// just on debug, update progress is not 'mission' critical.
LOG.debug("Error on update progress: ReaderPartLoadedEvent for unknown chunkPartStartNonce: '" + event.getChunkPartStartNonce() + "'!");
}
}
else
Expand Down

0 comments on commit 2fd231b

Please sign in to comment.