diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index 8d799e919d1e4c06cfec6438d7a4a34fc336993d..23ca3ddb8d6dd61801b7e96108f399ef4a75cc4d 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -424,8 +424,8 @@ int32_t vnodeGetCtbIdList(SVnode *pVnode, int64_t suid, SArray *list) { return TSDB_CODE_SUCCESS; } -int32_t vnodeGetStbIdList(SVnode* pVnode, int64_t suid, SArray* list) { - SMStbCursor* pCur = metaOpenStbCursor(pVnode->pMeta, suid); +int32_t vnodeGetStbIdList(SVnode *pVnode, int64_t suid, SArray *list) { + SMStbCursor *pCur = metaOpenStbCursor(pVnode->pMeta, suid); if (!pCur) { return TSDB_CODE_FAILED; } @@ -467,9 +467,13 @@ static int32_t vnodeGetStbColumnNum(SVnode *pVnode, tb_uid_t suid, int *num) { STSchema *pTSchema = metaGetTbTSchema(pVnode->pMeta, suid, -1); // metaGetTbTSchemaEx(pVnode->pMeta, suid, suid, -1, &pTSchema); - *num = pTSchema->numOfCols; + if (pTSchema) { + *num = pTSchema->numOfCols; - taosMemoryFree(pTSchema); + taosMemoryFree(pTSchema); + } else { + *num = 2; + } return TSDB_CODE_SUCCESS; }