Skip to content

Commit

Permalink
Fix #444 Crash from color search tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Sep 21, 2016
1 parent a860ced commit 5808b7f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
10 changes: 1 addition & 9 deletions src/main/java/mezz/jei/util/ItemStackElement.java
Expand Up @@ -140,15 +140,7 @@ private static String getColorString(ItemStack itemStack) {
return "";
}

final Collection<String> colorNames;
try {
colorNames = colorNamer.getColorNames(itemStack);
} catch (RuntimeException ignored) {
return "";
} catch (LinkageError ignored) {
return "";
}

Collection<String> colorNames = colorNamer.getColorNames(itemStack);
return Joiner.on(' ').join(colorNames).toLowerCase();
}

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/mezz/jei/util/color/ColorGetter.java
Expand Up @@ -72,6 +72,16 @@ public static String[] getColorDefaults() {
}

public static List<Color> getColors(ItemStack itemStack, int colorCount) {
try {
return _getColors(itemStack, colorCount);
} catch (RuntimeException ignored) {
return Collections.emptyList();
} catch (LinkageError ignored) {
return Collections.emptyList();
}
}

private static List<Color> _getColors(ItemStack itemStack, int colorCount) {
final Item item = itemStack.getItem();
if (item == null) {
return Collections.emptyList();
Expand Down

0 comments on commit 5808b7f

Please sign in to comment.