changeset 713:2c8fc0fd8c11

Don't send tree events with no selected item. Also don't strdup a NULL string.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 12 Mar 2011 14:56:44 +0000
parents 01107d8e033e
children cf6246f86c04
files mac/dw.m
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Sat Mar 12 14:42:56 2011 +0000
+++ b/mac/dw.m	Sat Mar 12 14:56:44 2011 +0000
@@ -258,6 +258,10 @@
                     {
                         text = strdup([nstr UTF8String]);
                     }
+                    else
+                    {
+                        text = NULL;
+                    }
                     int result = treeselectfunc(handler->window, item, text, handler->data, user);
                     free(text);
                     return result;
@@ -1177,7 +1181,10 @@
     /* Handler for tree class */
     id item = [self itemAtRow:[self selectedRow]];
 
-    _event_handler(self, (void *)item, 12);
+    if(item)
+    {
+        _event_handler(self, (void *)item, 12);
+    }
 }
 -(NSMenu *)menuForEvent:(NSEvent *)event 
 {