From 1cac3895dccfe848bdbc1170dfd49873c4287e5f Mon Sep 17 00:00:00 2001 From: Eric Xu Date: Sat, 22 May 2021 00:13:17 -0400 Subject: [PATCH] Refactor KioskTab.equals --- .../main/java/org/schabi/newpipe/settings/tabs/Tab.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java b/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java index ef683c033..ae5cd5e9c 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java +++ b/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java @@ -362,8 +362,13 @@ public abstract class Tab { @Override public boolean equals(final Object obj) { - return super.equals(obj) && kioskServiceId == ((KioskTab) obj).kioskServiceId - && Objects.equals(kioskId, ((KioskTab) obj).kioskId); + if (!(obj instanceof KioskTab)) { + return false; + } + final KioskTab other = (KioskTab) obj; + return super.equals(obj) + && kioskServiceId == other.kioskServiceId + && kioskId.equals(other.kioskId); } public int getKioskServiceId() {