Prevent potential division by zero
[jSite.git] / src / main / java / de / todesbaum / jsite / main / CLI.java
index 9f0b2db..1765074 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jSite - CLI.java - Copyright © 2006–2012 David Roden
+ * jSite - CLI.java - Copyright © 2006–2014 David Roden
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -104,6 +104,7 @@ public class CLI implements InsertListener {
                freenetInterface.setNode(node);
 
                projectInserter.setFreenetInterface(freenetInterface);
+        projectInserter.setPriority(configuration.getPriority());
 
                Project currentProject = null;
                for (String argument : args) {
@@ -271,6 +272,9 @@ public class CLI implements InsertListener {
         */
        @Override
        public void projectInsertProgress(Project project, int succeeded, int failed, int fatal, int total, boolean finalized) {
+               if (total == 0) {
+                       return;
+               }
                outputWriter.println("Progress: " + succeeded + " done, " + failed + " failed, " + fatal + " fatal, " + total + " total" + (finalized ? " (finalized)" : "") + ", " + ((succeeded + failed + fatal) * 100 / total) + "%");
        }