Skip to content

Commit

Permalink
fix: Crash when UINavigationController without rootViewController (#3455
Browse files Browse the repository at this point in the history
)

When a UINavigationController is not initialized with initWithRootViewController, it leads to a crash

Co-authored-by: Dhiogo Brustolin <[email protected]>
  • Loading branch information
wbcyclist and brustolin authored Nov 29, 2023
1 parent addcf42 commit 6e625c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Unreleased


### Fixes

- Crash when UINavigationController doesn't have rootViewController (#3455)

## 8.17.0

### Features
Expand Down
5 changes: 4 additions & 1 deletion Sources/Sentry/SentryUIApplication.m
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ - (BOOL)isContainerViewController:(UIViewController *)viewController
(UIViewController *)containerVC
{
if ([containerVC isKindOfClass:UINavigationController.class]) {
return @[ [(UINavigationController *)containerVC topViewController] ];
if ([(UINavigationController *)containerVC topViewController]) {
return @[ [(UINavigationController *)containerVC topViewController] ];
}
return nil;
}
if ([containerVC isKindOfClass:UITabBarController.class]) {
UITabBarController *tbController = (UITabBarController *)containerVC;
Expand Down

0 comments on commit 6e625c5

Please sign in to comment.