[PATCH] Crash on nonexisting can_handle_multiple_files property



Hi,

here's a patch that prevents a crash when the can_handle_multiple_files
property isn't provided by a bonobo property provider.
That's the case for the Totem property page atm - when you select
multiple video files and try to open their properties, it dereferences a
null pointer.

Martin

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.6075
diff -u -p -r1.6075 ChangeLog
--- ChangeLog	2 Feb 2004 08:31:51 -0000	1.6075
+++ ChangeLog	5 Feb 2004 05:34:12 -0000
@@ -1,3 +1,8 @@
+2004-02-05  Martin Wehner  <martin wehner epost de>
+
+	* src/file-manager/fm-bonobo-provider.c (can_handle_multiple_files):
+	Don't crash on nonexisting can_handle_multiple_files property.
+
 2004-02-02  Alexander Larsson  <alexl redhat com>
 
 	* libnautilus-private/nautilus-icon-factory.c (create_normal_cache_icon):
Index: src/file-manager/fm-bonobo-provider.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-bonobo-provider.c,v
retrieving revision 1.2
diff -u -p -r1.2 fm-bonobo-provider.c
--- src/file-manager/fm-bonobo-provider.c	11 Jan 2004 20:34:52 -0000	1.2
+++ src/file-manager/fm-bonobo-provider.c	5 Feb 2004 05:34:12 -0000
@@ -243,7 +243,12 @@ can_handle_multiple_files (Bonobo_Server
 	Bonobo_ActivationProperty *prop;
 
 	prop = bonobo_server_info_prop_find (info, "nautilus:can_handle_multiple_files");
-	return prop->v._u.value_boolean;
+
+	if (prop == NULL || prop->v._d != Bonobo_ACTIVATION_P_BOOLEAN) {
+		return FALSE;
+	} else {
+		return prop->v._u.value_boolean;
+	}
 }
 
 static GList *


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