Merge pull request #13820 from inietov/fixes/attempt_to_read_property_fields

Fixed Attempt to read property fields on null [sc-23903]
This commit is contained in:
snipe 2023-10-31 16:30:07 +00:00 committed by GitHub
commit 95e9002cd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -212,9 +212,11 @@ class Asset extends Depreciable
$this->rules += $model->fieldset->validation_rules();
foreach ($this->model->fieldset->fields as $field){
if($field->format == 'BOOLEAN'){
$this->{$field->db_column} = filter_var($this->{$field->db_column}, FILTER_VALIDATE_BOOLEAN);
if ($this->model->fieldset){
foreach ($this->model->fieldset->fields as $field){
if($field->format == 'BOOLEAN'){
$this->{$field->db_column} = filter_var($this->{$field->db_column}, FILTER_VALIDATE_BOOLEAN);
}
}
}
}