Skip to content

Comments

Fix exception when SVG icon name has no file extension#1087

Merged
DevCharly merged 1 commit intoJFormDesigner:mainfrom
poce1don:fix-svg-dark-icon-without-extension
Jan 30, 2026
Merged

Fix exception when SVG icon name has no file extension#1087
DevCharly merged 1 commit intoJFormDesigner:mainfrom
poce1don:fix-svg-dark-icon-without-extension

Conversation

@poce1don
Copy link
Contributor

@poce1don poce1don commented Jan 24, 2026

When using dark themes, FlatSVGIcon attempts to insert _dark before the file
extension. If the icon name does not contain a dot, this results in a
StringIndexOutOfBoundsException.

This situation can easily occur if the SVG file path is provided without the
.svg extension by mistake, since the API does not enforce or validate the
file name format.

This change adds a simple guard to avoid invalid substring operations when
no file extension is present, preventing runtime exceptions while preserving
existing behavior.

@DevCharly DevCharly merged commit 1a80a65 into JFormDesigner:main Jan 30, 2026
1 check failed
@DevCharly
Copy link
Collaborator

Merged in latest 3.7.1-SNAPSHOT: https://github.com/JFormDesigner/FlatLaf#snapshots

@DevCharly DevCharly added this to the 3.7.1 milestone Jan 30, 2026
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.

2 participants