Skip to content

Commit 5cb29db

Browse files
authored
Merge pull request #158 from hotwired/mb/crash_fixes
Fix crash when accessing currentDestination
2 parents b1da9af + 6e31684 commit 5cb29db

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

navigation-fragments/src/main/java/dev/hotwire/navigation/navigator/Navigator.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ class Navigator(
4343
*/
4444
val currentDestination: HotwireDestination?
4545
get() = currentDialogDestination as? HotwireDestination
46-
?: host.childFragmentManager.primaryNavigationFragment as? HotwireDestination
46+
?: if (isReady()) {
47+
host.childFragmentManager.primaryNavigationFragment as? HotwireDestination
48+
} else {
49+
null
50+
}
4751

4852
/**
4953
* Gets the location for the current destination.

0 commit comments

Comments
 (0)