diff --git a/src/Compatibility/ControlGallery/src/Issues.Shared/PerformanceGallery/PerformanceGallery.cs b/src/Compatibility/ControlGallery/src/Issues.Shared/PerformanceGallery/PerformanceGallery.cs index 0682c176feca..2a3dc99b8a8a 100644 --- a/src/Compatibility/ControlGallery/src/Issues.Shared/PerformanceGallery/PerformanceGallery.cs +++ b/src/Compatibility/ControlGallery/src/Issues.Shared/PerformanceGallery/PerformanceGallery.cs @@ -185,7 +185,7 @@ void HandleRenderComplete(PerformanceTracker obj) void NextButton_Clicked(object sender, EventArgs e) { - if (_TestCases?.Count == 0 || _TestNumber + 1 > _TestCases?.Count) + if (_TestCases == null || _TestCases.Count == 0 || _TestNumber + 1 > _TestCases.Count) return; ViewModel.View = null; diff --git a/src/Compatibility/Core/src/Android/CollectionView/CarouselViewRenderer.cs b/src/Compatibility/Core/src/Android/CollectionView/CarouselViewRenderer.cs index 8d87772d3206..5e555117d721 100644 --- a/src/Compatibility/Core/src/Android/CollectionView/CarouselViewRenderer.cs +++ b/src/Compatibility/Core/src/Android/CollectionView/CarouselViewRenderer.cs @@ -499,7 +499,7 @@ void UpdatePosition(int position) void SetCurrentItem(int carouselPosition) { - if (ItemsViewAdapter?.ItemsSource?.Count == 0) + if (ItemsViewAdapter?.ItemsSource == null || ItemsViewAdapter.ItemsSource.Count == 0) return; var item = ItemsViewAdapter.ItemsSource.GetItem(carouselPosition); diff --git a/src/Controls/src/Core/Handlers/Items/Android/MauiCarouselRecyclerView.cs b/src/Controls/src/Core/Handlers/Items/Android/MauiCarouselRecyclerView.cs index 6cf8f41d9894..634c6675ad4e 100644 --- a/src/Controls/src/Core/Handlers/Items/Android/MauiCarouselRecyclerView.cs +++ b/src/Controls/src/Core/Handlers/Items/Android/MauiCarouselRecyclerView.cs @@ -463,7 +463,7 @@ void UpdatePosition(int position) void SetCurrentItem(int carouselPosition) { - if (ItemsViewAdapter?.ItemsSource?.Count == 0) + if (ItemsViewAdapter?.ItemsSource == null || ItemsViewAdapter.ItemsSource.Count == 0) return; var item = ItemsViewAdapter.ItemsSource.GetItem(carouselPosition); diff --git a/src/Core/src/Platform/Android/MauiSwipeView.cs b/src/Core/src/Platform/Android/MauiSwipeView.cs index bc1ce01f761a..7b272c7d46bf 100644 --- a/src/Core/src/Platform/Android/MauiSwipeView.cs +++ b/src/Core/src/Platform/Android/MauiSwipeView.cs @@ -107,7 +107,7 @@ bool ShouldInterceptTouch(MotionEvent? e) var items = GetSwipeItemsByDirection(swipeDirection); - if (items == null || items?.Count == 0) + if (items == null || items.Count == 0) return false; return ShouldInterceptScrollChildrenTouch(swipeDirection); @@ -531,7 +531,7 @@ void UpdateSwipeItems() ISwipeItems? items = GetSwipeItemsByDirection(); - if (items?.Count == 0 || items == null) + if (items == null || items.Count == 0) return; _actionView = new LinearLayoutCompat(_context); diff --git a/src/Core/src/Platform/Tizen/MauiSwipeView.cs b/src/Core/src/Platform/Tizen/MauiSwipeView.cs index f6e44d325143..765a04860f31 100644 --- a/src/Core/src/Platform/Tizen/MauiSwipeView.cs +++ b/src/Core/src/Platform/Tizen/MauiSwipeView.cs @@ -271,7 +271,7 @@ void UpdateSwipeItems() ISwipeItems? items = GetSwipeItemsByDirection(); - if (items?.Count == 0 || items == null) + if (items == null || items.Count == 0) return; _actionView = new NView