Add invalid value to color-format exception

This commit is contained in:
Lukas Rieger (Blue) 2023-02-07 11:03:54 +01:00
parent ec2d316b63
commit cc99021ca8
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
2 changed files with 2 additions and 2 deletions

@ -1 +1 @@
Subproject commit c70ab29ae87cd79a3553bef4aca7fa94db577293
Subproject commit f9bbdc3d38405f59a82f427b868d6d5f7545738e

View File

@ -176,7 +176,7 @@ public Color parse(String val) {
if (val.length() == 3) val = val + "f";
if (val.length() == 4) val = "" + val.charAt(0) + val.charAt(0) + val.charAt(1) + val.charAt(1) + val.charAt(2) + val.charAt(2) + val.charAt(3) + val.charAt(3);
if (val.length() == 6) val = val + "ff";
if (val.length() != 8) throw new NumberFormatException("Invalid color format!");
if (val.length() != 8) throw new NumberFormatException("Invalid color format: '" + val + "'!");
val = val.substring(6, 8) + val.substring(0, 6); // move alpha to front
return set(Integer.parseUnsignedInt(val, 16));
}