--- \dll\postgresql-12.0\a\backend\executor\nodeUnique.c	Mon Sep 30 17:06:55 2019
+++ nodeUnique.c	Tue Nov 12 09:54:34 2019
@@ -74,7 +74,8 @@
 		if (TupIsNull(slot))
 		{
 			/* end of subplan, so we're done */
-			ExecClearTuple(resultTupleSlot);
+		    if (!TupIsNull(resultTupleSlot))
+			    ExecClearTuple(resultTupleSlot);
 			return NULL;
 		}
 
