Skip to content

Commit 451b543

Browse files
committed
[fix] Null pointer when activity finish
1 parent bacc468 commit 451b543

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

navigator/src/main/java/m/co/rh/id/anavigator/Navigator.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,14 @@ protected void initViewAnimator() {
11011101
private void checkAndConfigureRequestOrientation() {
11021102
Activity activity = getActivity();
11031103
int activityOrientation = activity.getRequestedOrientation();
1104-
StatefulView currentRoute = mNavRouteStack.peek().getStatefulView();
1104+
NavRoute navRoute = mNavRouteStack.peek();
1105+
if (navRoute == null) {
1106+
if (activityOrientation != mActivityDefaultScreenOrientation) {
1107+
activity.setRequestedOrientation(mActivityDefaultScreenOrientation);
1108+
}
1109+
return;
1110+
}
1111+
StatefulView currentRoute = navRoute.getStatefulView();
11051112
if (currentRoute instanceof NavActivity.RequestOrientation) {
11061113
int routeOrientation = ((NavActivity.RequestOrientation) currentRoute).getRequestedOrientation();
11071114
if (activityOrientation != routeOrientation) {

0 commit comments

Comments
 (0)