Skip to content

Commit bd5aaa1

Browse files
committed
Guard against null tensor
1 parent b723fa8 commit bd5aaa1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/redisai.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,9 @@ int RedisAI_Run_Reply(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
884884
RAI_Tensor *t = NULL;
885885
if (rinfo->mctx) {
886886
t = RAI_ModelRunCtxOutputTensor(rinfo->mctx, i);
887-
batch_size = RAI_TensorDim(t, 0);
887+
if (t && batch_size == 0) {
888+
batch_size = RAI_TensorDim(t, 0);
889+
}
888890
}
889891
else if (rinfo->sctx) {
890892
t = RAI_ScriptRunCtxOutputTensor(rinfo->sctx, i);

0 commit comments

Comments
 (0)