diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index c5670ae83..54346c229 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -2400,7 +2400,7 @@ __run_skip_1a: mysess->thread=NULL; // we first delete the association in sessmap sessmap.erase(mysess->thread_session_id); - if (mysql_sessions->len) { + if (mysql_sessions->len > 1) { // take the last element and adjust the map MySQL_Session *mysess_last=(MySQL_Session *)mysql_sessions->index(mysql_sessions->len-1); sessmap[mysess_last->thread_session_id]=sess_pos; @@ -2445,7 +2445,7 @@ __run_skip_1a: mysess->thread=NULL; // we first delete the association in sessmap sessmap.erase(mysess->thread_session_id); - if (mysql_sessions->len) { + if (mysql_sessions->len > 1) { // take the last element and adjust the map MySQL_Session *mysess_last=(MySQL_Session *)mysql_sessions->index(mysql_sessions->len-1); sessmap[mysess_last->thread_session_id]=sess_pos;