Prevent NPEs when the download hasn’t started yet.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 26 Apr 2013 05:14:35 +0000 (07:14 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 26 Apr 2013 05:14:35 +0000 (07:14 +0200)
src/main/java/net/pterodactylus/irc/DccReceiver.java

index 9ddca13..be4f145 100644 (file)
@@ -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;
        }
 
        //