Skip to content

[6.x] Prevent the icon fieldtype from 500ing when the stored icon no longer exists#14881

Open
mynetx wants to merge 1 commit into
statamic:6.xfrom
mynetx:fix/icon-fieldtype-missing-value
Open

[6.x] Prevent the icon fieldtype from 500ing when the stored icon no longer exists#14881
mynetx wants to merge 1 commit into
statamic:6.xfrom
mynetx:fix/icon-fieldtype-missing-value

Conversation

@mynetx

@mynetx mynetx commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

A stored icon value that no longer exists in the configured set throws a FileNotFoundException and 500s the page during augmentation. This bites after the v5 → v6 icon redesign, where icons like swap were removed, so existing content that references them now crashes on the front end.

IconSet::get() now checks the file exists and returns null when it doesn't, matching the svg tag's behaviour. Icon::augment() already short-circuits on a null, so it's a no-op for callers.

Fixes #14669

IconSet::get() loaded the SVG with no existence check, so a stored icon
value that no longer exists in the configured set (e.g. icons removed in
the v5 to v6 redesign) threw a FileNotFoundException and 500'd the page.
Return null for a missing icon instead; Icon::augment() already treats
null as an empty value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Icon fieldtype throws FileNotFoundException and 500s the page when stored value no longer exists in the configured icon set

1 participant