From 4d4710acb955530694f2434d95ed887d7b96ada7 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Tue, 28 Dec 2010 03:22:19 +0100 Subject: [PATCH] Fix "FATAL: list_remove: item not found" Thanks to Jean-Edouard Babin for reporting it. How to reproduce: 1) connect to bip with an irc client using username (eg 'Pilou') 2) disconnect irc client 3) in client configuration, change the case of username (eg 'pilou') 4) reconnect to bip -> bip log FATAL message and exit If old nick and new nick are equal ignoring the case of the characters, don't delete store associated with old nick: only rename it. --- src/log.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/log.c b/src/log.c index 5a96b47..823a3a5 100644 --- a/src/log.c +++ b/src/log.c @@ -475,10 +475,14 @@ void log_nick(log_t *logdata, const char *ircmask, const char *channel, const char *newnick) { char *oldnick = nick_from_ircmask(ircmask); + logstore_t* oldstore; + logstore_t* newstore; - if (hash_includes(&logdata->logfgs, oldnick)) { - if (hash_includes(&logdata->logfgs, newnick)) + if ((oldstore = hash_get(&logdata->logfgs, oldnick))) { + if ((newstore = hash_get(&logdata->logfgs, newnick)) + && oldstore != newstore) { log_drop(logdata, newnick); + } hash_rename_key(&logdata->logfgs, oldnick, newnick); } free(oldnick);