diff --git a/src/main/java/org/traccar/web/shared/model/User.java b/src/main/java/org/traccar/web/shared/model/User.java index 6a496eb6..8c556f05 100644 --- a/src/main/java/org/traccar/web/shared/model/User.java +++ b/src/main/java/org/traccar/web/shared/model/User.java @@ -463,7 +463,9 @@ public int getNumberOfDevicesToDistribute() { User manager = this; while (maxNumberOfDevices == null && manager != null) { maxNumberOfDevices = manager.getMaxNumOfDevices(); - manager = manager.getManagedBy(); + if (maxNumberOfDevices == null) { + manager = manager.getManagedBy(); + } } if (maxNumberOfDevices == null) { return Integer.MAX_VALUE;