A free open source IT asset/license management system
Fixed Call to a member function count() on null for location delete
snipea5b180a9c62a
diff --git a/app/Http/Controllers/LocationsController.php b/app/Http/Controllers/LocationsController.phpindex 77776084ba..9bbc7a7540 100755--- a/app/Http/Controllers/LocationsController.php+++ b/app/Http/Controllers/LocationsController.php@@ -199,16 +199,16 @@ class LocationsController extends Controllerreturn redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.not_found'));}- if ($location->users()->count() > 0) {+ if (($location->users()) && ($location->users()->count() > 0)) {return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_users'));- } elseif ($location->children->count() > 0) {+ } elseif (($location->children) && ($location->children->count() > 0)) {return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_child_loc'));- } elseif ($location->assets()->count() > 0) {+ } elseif (($location->assets()) && ($location->assets()->count() > 0)) {return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_assets'));- } elseif ($location->assignedassets()->count() > 0) {+ } elseif (($location->assignedassets()) && ($location->assignedassets()->count() > 0)) {return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_assets'));}