diff --git a/ground/src/main/java/com/google/android/ground/ui/offlineareas/viewer/OfflineAreaViewerFragment.kt b/ground/src/main/java/com/google/android/ground/ui/offlineareas/viewer/OfflineAreaViewerFragment.kt index f4e8aa0f62..11d4905f98 100644 --- a/ground/src/main/java/com/google/android/ground/ui/offlineareas/viewer/OfflineAreaViewerFragment.kt +++ b/ground/src/main/java/com/google/android/ground/ui/offlineareas/viewer/OfflineAreaViewerFragment.kt @@ -40,8 +40,12 @@ class OfflineAreaViewerFragment @Inject constructor() : AbstractMapContainerFrag override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - // TODO(#2649) requireNotNull will throw error, it should be handle smoothly - val args = OfflineAreaViewerFragmentArgs.fromBundle(requireNotNull(arguments)) + val args = + arguments?.let { OfflineAreaViewerFragmentArgs.fromBundle(it) } + ?: run { + findNavController().navigateUp() + return + } viewModel = getViewModel(OfflineAreaViewerViewModel::class.java) viewModel.initialize(args.offlineAreaId) }