summary refs log tree commit diff stats
path: root/tools/nimgrab.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tools/nimgrab.nim')
-rw-r--r--tools/nimgrab.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/nimgrab.nim b/tools/nimgrab.nim
index 69824369e..937a5dcd4 100644
--- a/tools/nimgrab.nim
+++ b/tools/nimgrab.nim
@@ -7,7 +7,11 @@ when defined(windows):
     proc progress(status: DownloadStatus, progress: uint, total: uint,
                   message: string) {.procvar, gcsafe.} =
       echo "Downloading " & url
-      echo clamp(int(progress.BiggestInt*100 div total.BiggestInt), 0, 100), "%"
+      let t = total.BiggestInt
+      if t != 0:
+        echo clamp(int(progress.BiggestInt*100 div t), 0, 100), "%"
+      else:
+        echo "0%"
 
     downloadToFile(url, file, {optUseCache}, progress)
     echo "100%"