Only try to get fieldset if model is valid

This commit is contained in:
snipe 2019-05-24 15:44:54 -07:00
parent 18db0a50f1
commit d5c3ee5ed0

View file

@ -446,7 +446,7 @@ class AssetsController extends Controller
// Update custom fields in the database.
// Validation for these fields is handled through the AssetRequest form request
$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')) {