From 2f09cc7cd6c86ece05864055eca4ddfd78c03179 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Fri, 20 Mar 2009 11:00:59 +0100 Subject: Fix crashers due to bad data parsing and bad treeview cell sorting --- src/guitools.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/guitools.cs') diff --git a/src/guitools.cs b/src/guitools.cs index 8828941..bdc9e8a 100755 --- a/src/guitools.cs +++ b/src/guitools.cs @@ -306,10 +306,19 @@ namespace gfax { bool is_sorted = ((Gtk.ListStore)model).GetSortColumnId (out col, out sort); if(!is_sorted) return 0; - - DateTime dateA = (DateTime)model.GetValue (a, col); - DateTime dateB = (DateTime)model.GetValue (b, col); - + + object oA = model.GetValue (a, col); + object oB = model.GetValue (b, col); + + if(oB == null) + return 1; + + if(oA == null) + return -1; + + DateTime dateA = (DateTime)oA; + DateTime dateB = (DateTime)oB; + return dateA.CompareTo(dateB); } -- cgit v1.1-32-gdbae