Check that a model exists before trying to fiddle with fieldsets

This commit is contained in:
snipe 2019-05-24 04:48:04 -07:00
parent aa0b627fe7
commit d4725b61be

View file

@ -183,7 +183,7 @@ class AssetsController extends Controller
// Validation for these fields is handled through the AssetRequest form request // Validation for these fields is handled through the AssetRequest form request
$model = AssetModel::find($request->get('model_id')); $model = AssetModel::find($request->get('model_id'));
if ($model->fieldset) { if (($model) && ($model->fieldset)) {
foreach ($model->fieldset->fields as $field) { foreach ($model->fieldset->fields as $field) {
if ($field->field_encrypted=='1') { if ($field->field_encrypted=='1') {
if (Gate::allows('admin')) { if (Gate::allows('admin')) {