Fix the exception on selection changed

The GetCodeWindow method was called on selection change events and it
was throwing a local exception when an error occurred.  Nothing wrong
here other than it made debugging exceptions difficult as it is a first
chance exception that keeps popping up.  Changed it to use a
non-exception path (except for Venus which can still throw)