[hyena] Handle bad indices in MemoryListModel
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena] Handle bad indices in MemoryListModel
- Date: Wed, 26 May 2010 02:37:17 +0000 (UTC)
commit a3e8b668d60b2d1b9073c8ddd8edc02b8ad49753
Author: Mike Gemünde <mike gemuende de>
Date: Sat Apr 24 17:41:37 2010 +0200
Handle bad indices in MemoryListModel
Makes sure that MemoryListModel returns correct values when bad indices are
given. This makes it compatible with how Banshee's MemoryListModel works.
Without this, grid view crashes.
https://bugzilla.gnome.org/show_bug.cgi?id=616710
src/Hyena/Hyena.Data/MemoryListModel.cs | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/Hyena/Hyena.Data/MemoryListModel.cs b/src/Hyena/Hyena.Data/MemoryListModel.cs
index ae037ee..27ca87e 100644
--- a/src/Hyena/Hyena.Data/MemoryListModel.cs
+++ b/src/Hyena/Hyena.Data/MemoryListModel.cs
@@ -81,6 +81,10 @@ namespace Hyena.Data
public override T this[int index] {
get {
lock (list) {
+ if (list.Count <= index || index < 0) {
+ return default (T);
+ }
+
return list[index];
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]