If adding a scene from the main window header, it is possible to have a defined `sequencer_scene` but an undefined `ed`. Add check for non-null `ed` and move all the checks up to the start of `sequencer_main_cursor`. Pull Request: https://projects.blender.org/blender/blender/pulls/145854