diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 782fac8686..f04992a5a1 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -3631,7 +3631,7 @@ int MySQL_Session::handler() { case PROCESSING_STMT_EXECUTE: { char sqlstate[10]; - if (myconn->mysql) { + if (myconn && myconn->mysql) { sprintf(sqlstate,"%s",mysql_sqlstate(myconn->mysql)); client_myds->myprot.generate_pkt_ERR(true,NULL,NULL,client_myds->pkt_sid+1,mysql_errno(myconn->mysql),sqlstate,(char *)mysql_stmt_error(myconn->query.stmt)); } else {