Skip to content

Commit

Permalink
Fix Zero Length check
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek committed Jul 23, 2024
1 parent d5eab86 commit ab96547
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/Core/src/Platform/Android/MauiSwipeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Platform/Tizen/MauiSwipeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ab96547

Please sign in to comment.