From 9ccdfac6455a75390bd350d4c927a921d4669443 Mon Sep 17 00:00:00 2001 From: borrmann Date: Mon, 12 Feb 2024 14:11:33 +0000 Subject: [PATCH] Dismiss may be called after the Bottomsheet was dismissed already. --- src/Platforms/Android/BottomSheetHandler.cs | 2 +- src/Platforms/iOS/BottomSheetHandler.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Platforms/Android/BottomSheetHandler.cs b/src/Platforms/Android/BottomSheetHandler.cs index 0a5aab8..545958d 100644 --- a/src/Platforms/Android/BottomSheetHandler.cs +++ b/src/Platforms/Android/BottomSheetHandler.cs @@ -13,7 +13,7 @@ partial void PlatformUpdateHandleColor(BottomSheet view) partial void Dismiss(BottomSheet view, object request) { - view.Controller?.Dismiss((bool)request); + view?.Controller?.Dismiss((bool)request); } partial void PlatformUpdateSelectedDetent(BottomSheet view) diff --git a/src/Platforms/iOS/BottomSheetHandler.cs b/src/Platforms/iOS/BottomSheetHandler.cs index 3dc9af6..c39c5ee 100644 --- a/src/Platforms/iOS/BottomSheetHandler.cs +++ b/src/Platforms/iOS/BottomSheetHandler.cs @@ -13,8 +13,8 @@ partial void PlatformUpdateHandleColor(BottomSheet view) partial void Dismiss(BottomSheet view, object request) { - view.CachedDetents.Clear(); - view.Controller?.DismissViewController((bool)request, view.NotifyDismissed); + view?.CachedDetents.Clear(); + view?.Controller?.DismissViewController((bool)request, view.NotifyDismissed); } partial void PlatformMapSelectedDetent(BottomSheet view)