Skip to content

A free open source IT asset/license management system

Fixes ternary that sets the offset in 0 when the offset passed to the API for the user is greater than total locations. (#9210)

Ivan Nieto Vivancoab7dd90602ad
diff --git a/app/Http/Controllers/Api/LocationsController.php b/app/Http/Controllers/Api/LocationsController.php
index c6fef93041..ed71685159 100644
--- a/app/Http/Controllers/Api/LocationsController.php
+++ b/app/Http/Controllers/Api/LocationsController.php
@@ -54,7 +54,7 @@ class LocationsController extends Controller
- $offset = (($locations) && (request('offset') > $locations->count())) ? 0 : request('offset', 0);
+ $offset = (($locations) && (request('offset') > $locations->count())) ? $locations->count() : request('offset', 0);
// Check to make sure the limit is not higher than the max allowed
((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results');