Skip to content

Commit 7fc26fe

Browse files
committed
Fix exception when SVG icon name has no file extension
1 parent 465254c commit 7fc26fe

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatSVGIcon.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,8 @@ private static SVGDocument loadSVGUncached( URL url ) {
524524
private URL getIconURL( String name, boolean dark ) {
525525
if( dark ) {
526526
int dotIndex = name.lastIndexOf( '.' );
527-
name = name.substring( 0, dotIndex ) + "_dark" + name.substring( dotIndex );
527+
if ( dotIndex > 0 )
528+
name = name.substring( 0, dotIndex ) + "_dark" + name.substring( dotIndex );
528529
}
529530

530531
ClassLoader cl = (classLoader != null) ? classLoader : FlatSVGIcon.class.getClassLoader();

0 commit comments

Comments
 (0)