diff --git a/src/tuplesort15.c b/src/tuplesort15.c
index 6f7a59f5d6..c2d856146a 100644
--- a/src/tuplesort15.c
+++ b/src/tuplesort15.c
@@ -2930,6 +2930,7 @@ selectnewtape(Tuplesortstate *state)
 	 * run, until maxTapes is reached.  After that, we assign new runs to the
 	 * existing tapes in a round robin fashion.
 	 */
+	Assert(state->maxTapes >= 1);
 	if (state->nOutputTapes < state->maxTapes)
 	{
 		/* Create a new tape to hold the next run */