Fix Widget#isHidden returning incorrect state when parent is null

This commit is contained in:
Lotto
2018-02-26 18:46:09 +01:00
parent 884ca28648
commit 856f1d9a96

View File

@@ -117,7 +117,23 @@ public abstract class RSWidgetMixin implements RSWidget
public boolean isHidden()
{
Widget parent = getParent();
return (parent != null && parent.isHidden()) || isRSHidden();
if (parent == null)
{
if (TO_GROUP(getId()) != client.getWidgetRoot())
{
// Widget has no parent and is not the root widget (which is always visible),
// so it's not visible.
return true;
}
}
else if (parent.isHidden())
{
// If the parent is hidden, this widget is also hidden.
return true;
}
return isRSHidden();
}
@Inject