소스 검색

wip: fix null $existingRecord

3.x
wallo 2 년 전
부모
커밋
6363c73454
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5
    0
      app/Traits/HandlesDefaultSettingRecordCreation.php

+ 5
- 0
app/Traits/HandlesDefaultSettingRecordCreation.php 파일 보기

@@ -28,6 +28,11 @@ trait HandlesDefaultSettingRecordCreation
28 28
         foreach ($relatedEntities as $field => $params) {
29 29
             [$class, $key, $type] = array_pad($params, 3, null);
30 30
 
31
+            if ($existingRecord === null || !isset($existingRecord->{$field})) {
32
+                $newData[$field] = $data[$field];
33
+                continue;
34
+            }
35
+
31 36
             if (isset($data[$field]) && $data[$field] !== $existingRecord->{$field}) {
32 37
                 $this->updateEnabledRecord($class, $key, $existingRecord->{$field}, $type, false);
33 38
                 $this->updateEnabledRecord($class, $key, $data[$field], $type, true);

Loading…
취소
저장