fix(android): NullPointerException crash due to null top screen (#323)

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.
This commit is contained in:
Matt Oakes
2020-02-11 22:35:10 +00:00
committed by GitHub
parent f7b6c22591
commit 24b70abd64

View File

@@ -50,7 +50,7 @@ public class ScreenStack extends ScreenContainer<ScreenStackFragment> {
}
public Screen getTopScreen() {
return mTopScreen.getScreen();
return mTopScreen != null ? mTopScreen.getScreen() : null;
}
public Screen getRootScreen() {