From cfda073aa572a06a0c2914caf12551d5e0c663e2 Mon Sep 17 00:00:00 2001 From: Hanif Shersy Date: Mon, 2 May 2022 12:23:29 +1000 Subject: [PATCH] Fix DeX mode check --- .../main/java/org/schabi/newpipe/util/DeviceUtils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java b/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java index d42926788..102541d64 100644 --- a/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java +++ b/app/src/main/java/org/schabi/newpipe/util/DeviceUtils.java @@ -120,10 +120,10 @@ public final class DeviceUtils { final Method getEnabledMethod = desktopModeStateClass .getDeclaredMethod("getEnabled"); final int enabled = (int) getEnabledMethod.invoke(desktopModeState); - final boolean isEnabled = enabled == desktopModeStateClass - .getDeclaredField("ENABLED").getInt(desktopModeStateClass); - - isDeXMode = isEnabled; + if (enabled == desktopModeStateClass + .getDeclaredField("ENABLED").getInt(desktopModeStateClass)) { + isDeXMode = true; + } } catch (NoSuchFieldException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { // Device does not support DeX 3.0