v.21.9Bug Fix

Fix nullptr dereference in window functions, addressing issue #25276

Fix potential nullptr dereference in window functions. This fixes #25276. #26668 (Alexander Kuzmenkov).