diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index 3f12bc811bd2508583397c37723b498c710088d1..a8aea1c8d3f4d4923ab648c1918da36d410edfa0 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -1528,13 +1528,14 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) { int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags) { STscStmt* pStmt = (STscStmt*)stmt; - SSqlObj* pSql = pStmt->pSql; - SSqlCmd* pCmd = &pSql->cmd; if (stmt == NULL || pStmt->pSql == NULL || pStmt->taos == NULL) { STMT_RET(TSDB_CODE_TSC_DISCONNECTED); } + SSqlObj* pSql = pStmt->pSql; + SSqlCmd* pCmd = &pSql->cmd; + if (name == NULL) { tscError("0x%"PRIx64" name is NULL", pSql->self); STMT_RET(invalidOperationMsg(tscGetErrorMsgPayload(&pStmt->pSql->cmd), "name is NULL"));