statamic / seo-pro

An all-in-one site reporting, metadata wrangling, Open Graph managing, Twitter card making, sitemap generating, turn-key addon for Statamic.
https://statamic.com/addons/statamic/seo-pro
52 stars 34 forks source link

Fix rare `fieldtype() on null` error, preventing the ability to save an entry #240

Closed jesseleite closed 1 year ago

jesseleite commented 1 year ago

If you've migrated a Statamic v2 site, you may have sitemap: true set in a collection's section defaults. This causes errors on the section defaults form, and also a Call to a member function fieldtype() on null error that prevents the ability to save an entry.

Though we could have originally addressed this in statamic/migrator, this PR fixes the issue for all users (including those who have already migrated from v2) by normalizing the sitemap's field value here in the addon.

Closes #238.

what-the-diff[bot] commented 1 year ago