diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-06-17 04:42:03 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-06-17 04:42:03 +0000 |
commit | b2db3590c25a1b950b66ab9a21dfcc3a2747d393 (patch) | |
tree | ae7078c4890f149bff1252e7c637ece3981d113d | |
parent | 61bb6325b7eaf6bb999eec3daba5228dc2537260 (diff) |
Fix doubly-linked list delete
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3234 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | apps/app_meetme.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 57cb46f01..9b513661a 100755 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -938,14 +938,30 @@ outrun: } 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))); |