mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-22 19:58:32 +08:00
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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user