Skip to content

A free open source IT asset/license management system

Fix division by zero?

snipef49837e5feaf
diff --git a/app/Models/Consumable.php b/app/Models/Consumable.php
index 39892ac4e3..d94c3d4dbc 100644
--- a/app/Models/Consumable.php
+++ b/app/Models/Consumable.php
@@ -170,6 +170,10 @@ class Consumable extends SnipeModel
return 100;
}
+ if ($this->qty == '') {
+ return 1;
+ }
+
return ($this->qty - $this->consumables_users_count) / $this->qty * 100;
}