Browse code

- fixed a crash in mysql_stmt_fetch when the statement does not exist

Jan Janak authored on 01/06/2008 19:22:15
Showing 1 changed files
... ...
@@ -1231,6 +1231,12 @@ int my_cmd_next(db_res_t* res)
1231 1231
 
1232 1232
 	mcmd = DB_GET_PAYLOAD(res->cmd);
1233 1233
 	if (mcmd->next_flag == 2 || mcmd->next_flag == -2) return 1;
1234
+
1235
+	if (mcmd->st == NULL) {
1236
+		ERR("mysql: Prepared statement not found\n");
1237
+		return -1;
1238
+	}
1239
+
1234 1240
 	ret = mysql_stmt_fetch(mcmd->st);
1235 1241
 	
1236 1242
 	if (ret == MYSQL_NO_DATA) {