[blam/blam-1.8.10] ChannelList: don't crash if drop happens after last element



commit 707fcc610aaea91ae79085222e6054b123e6e0bb
Author: Carlos MartÃn Nieto <carlos cmartin tk>
Date:   Sat May 12 19:36:45 2012 +0200

    ChannelList: don't crash if drop happens after last element
    
    When a drag-n-dop's dop happens after the last element of the
    TreeView, the path is null. Catch this case and don't do anything
    instead of trying to copy it and crashing.

 src/ChannelList.cs |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/ChannelList.cs b/src/ChannelList.cs
index b9c516e..840d7be 100644
--- a/src/ChannelList.cs
+++ b/src/ChannelList.cs
@@ -121,9 +121,12 @@ namespace Imendio.Blam {
 			Model.GetIter(out iter, path);
 			IChannel dst = Model.GetValue(iter, 0) as IChannel;
 
+			/* path is null if the drop happened after the last position */
+			if (path == null)
+				return;
+
 			/* Not directly over a channel. */
 			if(pos == TreeViewDropPosition.After || pos == TreeViewDropPosition.Before){
-
 				TreePath tmp_path = path.Copy();
 				tmp_path.Up();
 				TreePath tmp_path_src = Model.GetPath(src.Iter).Copy();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]