diff --git a/src/controllers/CraftEntryController.php b/src/controllers/CraftEntryController.php index 5232b26..a2016f0 100644 --- a/src/controllers/CraftEntryController.php +++ b/src/controllers/CraftEntryController.php @@ -38,8 +38,12 @@ protected static function getEntry(CraftEntry $model): CraftElementEntry return $entry; } - protected static function applySettings(CraftElementEntry $entry, stdClass $settings): void + protected static function applySettings(CraftElementEntry $entry, ?stdClass $settings): void { + if (is_null($settings)) { + return; + } + // Set Craft CMS title & slug if (is_null($entry->id) || $settings->updateTitleAndSlug) { if (isset($settings->title)) { @@ -151,7 +155,7 @@ public static function updateOrCreateEntry(CraftEntry $model): CraftElementEntry self::saveAssets($entry, $model->assets); } - self::applySettings($entry, $model->fields->settings); + self::applySettings($entry, $model->fields->settings ?? null); unset($model->fields->settings); $entry->setFieldValues(json_decode(json_encode($model->fields), true));