Skip to content

Commit

Permalink
RenderDeviceJme: CachedTextKey.equals() lacks a type check (#1768)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Feb 10, 2022
1 parent 475abdf commit 2a661dc
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions jme3-niftygui/src/main/java/com/jme3/niftygui/RenderDeviceJme.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,20 @@ public CachedTextKey(BitmapFont font, String text/*, ColorRGBA color*/) {
}

@Override
public boolean equals(Object other) {
CachedTextKey otherKey = (CachedTextKey) other;
return font.equals(otherKey.font) &&
text.equals(otherKey.text)/* &&
color.equals(otherKey.color)*/;
public boolean equals(Object otherObject) {
boolean result;
if (otherObject == this) {
result = true;
} else if (otherObject != null
&& otherObject.getClass() == getClass()) {
CachedTextKey otherKey = (CachedTextKey) otherObject;
result = font.equals(otherKey.font)
&& text.equals(otherKey.text);
} else {
result = false;
}

return result;
}

@Override
Expand Down

0 comments on commit 2a661dc

Please sign in to comment.