add new check method for window parameter should not be nil
FIX segfault in window_parent_check
add nil_check also when window_parent_check check is used because
otherwise it could crash