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

This commit is contained in:
Karl Tauber
2026-01-30 13:17:56 +01:00

View File

@@ -524,7 +524,9 @@ public class FlatSVGIcon
private URL getIconURL( String name, boolean dark ) { private URL getIconURL( String name, boolean dark ) {
if( dark ) { if( dark ) {
int dotIndex = name.lastIndexOf( '.' ); int dotIndex = name.lastIndexOf( '.' );
name = name.substring( 0, dotIndex ) + "_dark" + name.substring( dotIndex ); name = (dotIndex > 0)
? name.substring( 0, dotIndex ) + "_dark" + name.substring( dotIndex )
: name + "_dark";
} }
ClassLoader cl = (classLoader != null) ? classLoader : FlatSVGIcon.class.getClassLoader(); ClassLoader cl = (classLoader != null) ? classLoader : FlatSVGIcon.class.getClassLoader();