From ea3e1a202e51c769286d434f9da3fdd698aee70e Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 6 May 2022 22:12:35 +0800 Subject: [PATCH] fix(query): add some check for null pointer. --- source/libs/executor/src/sortoperator.c | 4 ++++ source/libs/executor/src/tsort.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index 619651f11f..b34889ec46 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -67,6 +67,10 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i ASSERT(taosArrayGetSize(pColMatchInfo) == pDataBlock->info.numOfCols); SSDataBlock* p = tsortGetSortedDataBlock(pHandle); + if (p == NULL) { + return NULL; + } + blockDataEnsureCapacity(p, capacity); while (1) { diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 040ee8c7f5..d585988e5e 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -553,7 +553,7 @@ static int32_t createInitialSortedMultiSources(SSortHandle* pHandle) { } } - if (pHandle->pDataBlock->info.rows > 0) { + if (pHandle->pDataBlock != NULL && pHandle->pDataBlock->info.rows > 0) { size_t size = blockDataGetSize(pHandle->pDataBlock); // Perform the in-memory sort and then flush data in the buffer into disk. -- GitLab