Fix crash when accessing lastFocusBookmark if editor is not visible

In certain circumstances the editor is not visible when this function is called, which results in a crash. Added a null check to fix this issue.