mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Check for valid model before attempting to access fieldsets
Fixes [ch1249]
This commit is contained in:
parent
fcbc7e4540
commit
1472e9d5b5
|
@ -380,7 +380,7 @@ class AssetsController extends Controller
|
||||||
// FIXME: No idea why this is returning a Builder error on db_column_name.
|
// FIXME: No idea why this is returning a Builder error on db_column_name.
|
||||||
// Need to investigate and fix. Using static method for now.
|
// Need to investigate and fix. Using static method for now.
|
||||||
$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')) {
|
||||||
|
|
Loading…
Reference in a new issue