Check for valid model before attempting to access fieldsets

Fixes [ch1249]
This commit is contained in:
snipe 2019-05-24 15:03:15 -07:00
parent fcbc7e4540
commit 1472e9d5b5

View file

@ -380,7 +380,7 @@ class AssetsController extends Controller
// FIXME: No idea why this is returning a Builder error on db_column_name.
// Need to investigate and fix. Using static method for now.
$model = AssetModel::find($request->get('model_id'));
if ($model->fieldset) {
if (($model) && ($model->fieldset)) {
foreach ($model->fieldset->fields as $field) {
if ($field->field_encrypted=='1') {
if (Gate::allows('admin')) {