Test for NULL associated frame in doc/view event handling code.

A view might not have any associated frame at all (this is probably a bad idea
but we don't seem to explicitly forbid this).

This should have been part of r73943, see #14314.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73945 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775