Handled bad model id

This commit is contained in:
snipe 2017-01-12 03:53:52 -08:00
parent 41b864cc49
commit a283b13069

View file

@ -291,8 +291,7 @@ class AssetsController extends Controller
$asset->company_id = Company::getIdForCurrentUser($request->get('company_id')) : '';
if ($request->has('model_id')) {
$model = AssetModel::find($request->get('model_id'));
if ($model->fieldset) {
if ($model = AssetModel::find($request->get('model_id'))) {
foreach ($model->fieldset->fields as $field) {
if ($request->has(CustomField::name_to_db_name($field->name))) {
$asset->{CustomField::name_to_db_name($field->name)} = e($request->input(CustomField::name_to_db_name($field->name)));