Skip to content

Commit

Permalink
fix nil panic
Browse files Browse the repository at this point in the history
  • Loading branch information
daviszhen committed Nov 6, 2024
1 parent 173985a commit 918113f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/frontend/mysql_cmd_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -3171,10 +3171,15 @@ func ExecRequest(ses *Session, execCtx *ExecCtx, req *Request) (resp *Response,
ses.SetCmd(COM_STMT_EXECUTE)
var prepareStmt *PrepareStmt
sql, prepareStmt, err = parseStmtExecute(execCtx.reqCtx, ses, req.GetData().([]byte))
execCtx.prepareColDef = prepareStmt.ColDefData
if err != nil {
return NewGeneralErrorResponse(COM_STMT_EXECUTE, ses.GetTxnHandler().GetServerStatus(), err), nil
}
if prepareStmt == nil {
return NewGeneralErrorResponse(COM_STMT_EXECUTE, ses.GetTxnHandler().GetServerStatus(),
moerr.NewInternalError(execCtx.reqCtx, "prepare stmt is nil")),
nil
}
execCtx.prepareColDef = prepareStmt.ColDefData
err = doComQuery(ses, execCtx, &UserInput{sql: sql, stmtName: prepareStmt.Name, stmt: prepareStmt.PrepareStmt, preparePlan: prepareStmt.PreparePlan, isBinaryProtExecute: true})
if err != nil {
resp = NewGeneralErrorResponse(COM_STMT_EXECUTE, ses.GetTxnHandler().GetServerStatus(), err)
Expand Down

0 comments on commit 918113f

Please sign in to comment.