Move device exist check to prevent error (#12232)

This commit is contained in:
Jellyfrog 2020-10-20 13:28:03 +02:00 committed by GitHub
parent 6416de5bd3
commit 0b6231be1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,12 +60,13 @@ class DeviceController extends Controller
$device = str_replace('device=', '', $device);
$device = is_numeric($device) ? DeviceCache::get($device) : DeviceCache::getByHostname($device);
$device_id = $device->device_id;
DeviceCache::setPrimary($device_id);
if (! $device->exists) {
abort(404);
}
DeviceCache::setPrimary($device_id);
$current_tab = str_replace('tab=', '', $current_tab);
$current_tab = array_key_exists($current_tab, $this->tabs) ? $current_tab : 'overview';