Skip to content

Commit 216887d

Browse files
authored
Fix rare fieldtype() on null error, preventing the ability to save an entry (#240)
1 parent 7669ee4 commit 216887d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Fieldtypes/SourceFieldtype.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ public function preProcess($data)
3636
return ['source' => 'inherit', 'value' => $data];
3737
}
3838

39+
// Handle issue with legacy `sitemap: true` section default.
40+
// This shouldn't ever be explicitly set `true` in Statamic v3,
41+
// but it may be migrated as `true` when coming from Statamic v2.
42+
if ($this->field->handle() === 'sitemap' && $originalData === true) {
43+
return ['source' => 'inherit', 'value' => null];
44+
}
45+
3946
return ['source' => 'custom', 'value' => $data];
4047
}
4148

0 commit comments

Comments
 (0)