Skip to content

Commit a8bb7d8

Browse files
committed
Add check for empty collection
1 parent 6879d03 commit a8bb7d8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/PJ.ContextActions.Maui/Controls/ContextActionBehavior.android.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ partial class ContextActionBehavior : PlatformBehavior<View, AView>
99

1010
protected override void OnAttachedTo(View bindable, AView platformView)
1111
{
12+
if (MenuItems.Count is 0)
13+
{
14+
return;
15+
}
1216
var contextMenuListener = ContextMenuListenerFactory?.Invoke() ?? new AViewContextMenuListener([.. MenuItems], bindable);
1317
platformView.SetOnCreateContextMenuListener(contextMenuListener);
1418
}

0 commit comments

Comments
 (0)