Skip to content

Commit

Permalink
Merge pull request #20772 from daordonez11/hotfix-app-crash-publicroom
Browse files Browse the repository at this point in the history
hotfix(publicroom):Avoid crash on undefined state
  • Loading branch information
mountiny authored Jun 21, 2023
2 parents 1096b6e + 2332530 commit 40ece23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libs/Navigation/NavigationRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ function NavigationRoot(props) {
const navigationStateRef = useRef(undefined);

const updateSavedNavigationStateAndLogRoute = (state) => {
if (!state) {
return;
}
navigationStateRef.current = state;
props.updateCurrentReportId(state);
parseAndLogRoute(state);
Expand Down
3 changes: 3 additions & 0 deletions src/libs/Navigation/getTopmostReportId.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import lodashGet from 'lodash/get';
* @returns {String | undefined} - It's possible that there is no report screen
*/
function getTopmostReportId(state) {
if (!state) {
return;
}
const topmostCentralPane = lodashFindLast(state.routes, (route) => route.name === 'CentralPaneNavigator');

if (!topmostCentralPane) {
Expand Down

0 comments on commit 40ece23

Please sign in to comment.