diff options
author | kingces95 <kingces95@users.noreply.github.com> | 2017-06-14 19:14:08 -0400 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2017-06-14 16:14:08 -0700 |
commit | 6f5d6ce8daf280ce3f5717cb90ee2e73ae9e474b (patch) | |
tree | 375f1ddd4cf5ec57b50f4b540d3f707a6c888675 /Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs | |
parent | ec5492cd0da754bb372961a30170b7d3ce165ac2 (diff) | |
download | xamarin-forms-6f5d6ce8daf280ce3f5717cb90ee2e73ae9e474b.tar.gz xamarin-forms-6f5d6ce8daf280ce3f5717cb90ee2e73ae9e474b.tar.bz2 xamarin-forms-6f5d6ce8daf280ce3f5717cb90ee2e73ae9e474b.zip |
Provide better exception for bad INotifyCollectionChanged index bounds (#948)
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs index 3c5bcb10..84c0daa1 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs @@ -500,6 +500,11 @@ namespace Xamarin.Forms.Platform.iOS var groupReset = resetWhenGrouped && Element.IsGroupingEnabled; + var lastIndex = Control.NumberOfRowsInSection(section); + if (e.NewStartingIndex > lastIndex || e.OldStartingIndex > lastIndex) + throw new ArgumentException( + $"Index '{Math.Max(e.NewStartingIndex, e.OldStartingIndex)}' is greater than the number of rows '{lastIndex}'."); + switch (e.Action) { case NotifyCollectionChangedAction.Add: |