[PATCH] Don't crash when enabling memo_file conduit for the first timeThe



The following patch fixes a crash when enabling the memo_file conduit
for the first time. It happens because the memo directory isn't set, and
a fix introduced just before 0.8 tries to remove trailing slashes (or
something) on an empty string.

This fixes 73294, 73064 and 73079 in bugzilla (identical stack trace),
and probably also 66247 and others.

Can someone privileged review and commit (or tell me to make a version
with a default value when the string is empty, which I would if someone
could tell me if there's a better way to get the base pilot directory
than using gnome_config and getting "basedir" from .gnome/gpilotd ;)
-- 
    Håvard

havardw stud ntnu no||http://www.stud.ntnu.no/~havardw||+47 93 84 64 68
All it takes to start an avalanche is one snowflake||Or a snowboarder
     Oh! Un Fraggle! Regarde, maman! J'ai attrapé un Fraggle!
Index: memo_file/memo_file_conduit.c
===================================================================
RCS file: /cvs/gnome/gnome-pilot-conduits/memo_file/memo_file_conduit.c,v
retrieving revision 1.39
diff -u -r1.39 memo_file_conduit.c
--- memo_file/memo_file_conduit.c	2001/11/22 03:39:28	1.39
+++ memo_file/memo_file_conduit.c	2002/03/05 17:01:08
@@ -85,8 +85,10 @@
   
 	(*c)->dir = gnome_config_get_string ("dir");
 
-	while ((*c)->dir[strlen ((*c)->dir)-1] == '/') {
-		(*c)->dir[strlen ((*c)->dir)-1] = '\0';
+	if ((*c)->dir != NULL) {
+		while ((*c)->dir[strlen ((*c)->dir)-1] == '/') {
+			(*c)->dir[strlen ((*c)->dir)-1] = '\0';
+		}
 	}
 
 


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