diff --git a/jme3-niftygui/src/main/java/com/jme3/niftygui/RenderDeviceJme.java b/jme3-niftygui/src/main/java/com/jme3/niftygui/RenderDeviceJme.java index 9359ee1bba..73dca7850c 100644 --- a/jme3-niftygui/src/main/java/com/jme3/niftygui/RenderDeviceJme.java +++ b/jme3-niftygui/src/main/java/com/jme3/niftygui/RenderDeviceJme.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2021 jMonkeyEngine + * Copyright (c) 2009-2022 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,11 +93,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