diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index cf667c8121..d87cb2557d 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -1502,7 +1502,8 @@ row_is_in_frame(WindowObject winobj, int64 pos, TupleTableSlot *slot,
 			if (pos > winstate->currentpos)
 			{
 				if (fetch_tuple)
-					window_gettupleslot(winobj, pos, slot);
+					if (!window_gettupleslot(winobj, pos, slot))
+						elog(ERROR, "could not re-fetch previously fetched frame row");
 				if (!are_peers(winstate, slot, winstate->ss.ss_ScanTupleSlot))
 					return -1;
 			}
