[Asterisk-cvs] asterisk/apps app_meetme.c,1.42,1.43

markster at lists.digium.com markster at lists.digium.com
Thu Jun 17 00:56:06 CDT 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv5097/apps

Modified Files:
	app_meetme.c 
Log Message:
Fix doubly-linked list delete


Index: app_meetme.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_meetme.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- app_meetme.c	17 Jun 2004 02:42:42 -0000	1.42
+++ app_meetme.c	17 Jun 2004 04:42:03 -0000	1.43
@@ -938,14 +938,30 @@
 		} else {
 			/* Remove the user struct */ 
 			if (user == conf->firstuser) {
-				user->nextuser->prevuser = NULL;
+				if (user->nextuser) {
+					/* There is another entry */
+					user->nextuser->prevuser = NULL;
+				} else {
+					/* We are the only entry */
+					conf->lastuser = NULL;
+				}
+				/* In either case */
 				conf->firstuser = user->nextuser;
 			} else if (user == conf->lastuser){
-				user->prevuser->nextuser = NULL;
+				if (user->prevuser)
+					user->prevuser->nextuser = NULL;
+				else
+					ast_log(LOG_ERROR, "Bad bad bad!  We're the last, not the first, but nobody before us??\n");
 				conf->lastuser = user->prevuser;
 			} else {
-				user->nextuser->prevuser = user->prevuser;
-				user->prevuser->nextuser = user->nextuser;
+				if (user->nextuser)
+					user->nextuser->prevuser = user->prevuser;
+				else
+					ast_log(LOG_ERROR, "Bad! Bad! Bad! user->nextuser is NULL but we're not the end!\n");
+				if (user->prevuser)
+					user->prevuser->nextuser = user->nextuser;
+				else
+					ast_log(LOG_ERROR, "Bad! Bad! Bad! user->prevuser is NULL but we're not the beginning!\n");
 			}
 			/* Return the number of seconds the user was in the conf */
 			sprintf(meetmesecs, "%i", (int) (user->jointime - time(NULL)));




More information about the svn-commits mailing list