Skip to content

Commit

Permalink
fix(android): NullPointerException crash due to null top screen (#323)
Browse files Browse the repository at this point in the history
The library would crash when the `mTopScreen` instance variable is null. This change checkes if it null before calling the `getScreen()` method. It also marks the method as having a nullable return value. The only place this method is used is already setup to handle `null` responses.
  • Loading branch information
matt-oakes committed Feb 11, 2020
1 parent f7b6c22 commit 24b70ab
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void dismiss(ScreenStackFragment screenFragment) {
}

public Screen getTopScreen() {
return mTopScreen.getScreen();
return mTopScreen != null ? mTopScreen.getScreen() : null;
}

public Screen getRootScreen() {
Expand Down

0 comments on commit 24b70ab

Please sign in to comment.