From: David ‘Bombe’ Roden Date: Fri, 26 Apr 2013 05:14:35 +0000 (+0200) Subject: Prevent NPEs when the download hasn’t started yet. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=e3d5be1bb8fb742facae438ae2c36d55331e953e;p=xudocci.git Prevent NPEs when the download hasn’t started yet. --- diff --git a/src/main/java/net/pterodactylus/irc/DccReceiver.java b/src/main/java/net/pterodactylus/irc/DccReceiver.java index 9ddca13..be4f145 100644 --- a/src/main/java/net/pterodactylus/irc/DccReceiver.java +++ b/src/main/java/net/pterodactylus/irc/DccReceiver.java @@ -155,7 +155,7 @@ public class DccReceiver extends AbstractExecutionThreadService { * @return The current rate of the download, in bytes/second */ public long currentRate() { - return inputStream.getCurrentRate(); + return (inputStream != null) ? inputStream.getCurrentRate() : 0; } /** @@ -164,7 +164,7 @@ public class DccReceiver extends AbstractExecutionThreadService { * @return The overall rate of the download, in bytes/second */ public long overallRate() { - return inputStream.getOverallRate(); + return (inputStream != null) ? inputStream.getOverallRate() : 0; } //