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

This commit is contained in:
snipe 2018-03-05 22:44:05 -08:00
parent 04d2542b81
commit d60c9800c2

View file

@ -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;