diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 64e157de1..d780c2fa2 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -4243,6 +4243,11 @@ void MySQL_Session::MySQL_Stmt_Result_to_MySQL_wire(MYSQL_STMT *stmt, MySQL_Conn } void MySQL_Session::MySQL_Result_to_MySQL_wire(MYSQL *mysql, MySQL_ResultSet *MyRS, MySQL_Data_Stream *_myds) { + if (mysql == NULL) { + // error + client_myds->myprot.generate_pkt_ERR(true,NULL,NULL,client_myds->pkt_sid+1, 2013, (char *)"HY000" ,(char *)"Lost connection to MySQL server during query"); + return; + } if (MyRS) { assert(MyRS->result); bool transfer_started=MyRS->transfer_started;