Check that the user exists before trying to get location id

This commit is contained in:
snipe 2016-09-29 10:32:09 -07:00
parent fc07753a5c
commit 0a218a37d0

View file

@ -518,7 +518,7 @@ class ReportsController extends Controller
} }
if (e(Input::get('location')) == '1') { if (e(Input::get('location')) == '1') {
$show_loc = ''; $show_loc = '';
if (( $asset->assigned_to > 0 ) && ( $asset->assigneduser->location_id !='' )) { if (( $asset->assigned_to > 0 ) && ( $asset->assigneduser) && ( $asset->assigneduser->location_id !='' )) {
$location = Location::find($asset->assigneduser->location_id); $location = Location::find($asset->assigneduser->location_id);
if ($location) { if ($location) {
$show_loc .= '"' .e($location->name). '"'; $show_loc .= '"' .e($location->name). '"';