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.
This commit is contained in:
Pierre-Louis Bonicoli 2010-12-28 03:22:19 +01:00
parent ca1b383a74
commit 4d4710acb9
1 changed files with 6 additions and 2 deletions

View File

@ -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);