Skip to content

A free open source IT asset/license management system

Check that the id key exists to prevent any weird edge cases for location

sniped60c9800c2b4
diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php
index 7b7571bf40..4ec7509d15 100755
--- a/app/Console/Commands/LdapSync.php
+++ b/app/Console/Commands/LdapSync.php
@@ -191,7 +191,7 @@ class LdapSync extends Command
$user->location_id = $item['location_id'];
} elseif ((isset($location)) && (!empty($location))) {
- if (is_array($location)) {
+ if ((is_array($location)) && (array_key_exists('id', $location))) {
$user->location_id = $location['id'];
} elseif (is_object($location)) {
$user->location_id = $location->id;