Browse Source

Check for null/empty key early.

pull/189/head
weisj 4 years ago
parent
commit
4a540ed520
  1. 5
      property-loader/src/main/java/com/github/weisj/darklaf/icons/IconColorMapper.java

5
property-loader/src/main/java/com/github/weisj/darklaf/icons/IconColorMapper.java

@ -176,6 +176,7 @@ public final class IconColorMapper {
}
private static float getOpacity(final String key, final String[] fallbacks, final Map<Object, Object> propertyMap) {
if ((key == null || key.isEmpty()) && (fallbacks == null || fallbacks.length == 0)) return -1;
// UIManager defaults to 0, if the value isn't an integer (or null).
Number obj = get(propertyMap, key, fallbacks, Number.class);
if (obj instanceof Integer) {
@ -187,9 +188,7 @@ public final class IconColorMapper {
} else if (obj instanceof Double) {
return obj.floatValue();
}
if (key != null && !key.isEmpty()) {
LOGGER.warning(obj + " is an invalid opacity value. Key = '" + key + "'");
}
LOGGER.warning(obj + " is an invalid opacity value. Key = '" + key + "'");
// In this case we default to -1.
return -1;
}

Loading…
Cancel
Save