Added check for no window.