From 32754c800590aaddcf924db1010ac59892b7b1b6 Mon Sep 17 00:00:00 2001 From: Farhan Arshad Date: Tue, 15 Aug 2023 13:39:56 +0500 Subject: [PATCH] fix: Issue `NullPointerException` on `CourseComponent#isVideoBlock()` - The issue appears when app tries to check the component type on `Activity#onResume` while app still restoring the component information for `CourseUnitNavigationActivity`. Fixes: LEARNER-9527 --- .../java/org/edx/mobile/view/CourseUnitNavigationActivity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseUnitNavigationActivity.java b/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseUnitNavigationActivity.java index 6ff6f12c42..2730b15463 100644 --- a/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseUnitNavigationActivity.java +++ b/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseUnitNavigationActivity.java @@ -469,7 +469,8 @@ public void onConfigurationChanged(@NonNull Configuration newConfig) { } private void updateUIForOrientation() { - if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && selectedUnit.isVideoBlock()) { + if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && + selectedUnit != null && selectedUnit.isVideoBlock()) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setActionBarVisible(false); findViewById(R.id.course_unit_nav_bar).setVisibility(View.GONE);