Add invalid value to color-format exception

This commit is contained in:
Lukas Rieger (Blue) 2023-02-07 11:03:21 +01:00
parent c70ab29ae8
commit f9bbdc3d38
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2

View File

@ -136,7 +136,7 @@ private static int parseColorString(String 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 Integer.parseUnsignedInt(val, 16);
}