Skip to content

Commit

Permalink
Small fix to guard against None (#2357)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwortmann authored Nov 4, 2023
1 parent dad2fe1 commit f07c307
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugin/core/open.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _find_open_file(window: sublime.Window, fname: str, group: int = -1) -> Opti
"""A replacement for Window.find_open_file that prefers the active view instead of the leftmost one."""
_group = window.active_group() if group == -1 else group
view = window.active_view_in_group(_group)
if fname == view.file_name():
if view and fname == view.file_name():
return view
return window.find_open_file(fname, group)

Expand Down
2 changes: 1 addition & 1 deletion stubs/sublime.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ class Window:
def active_sheet_in_group(self, group: int) -> 'Sheet':
...

def active_view_in_group(self, group: int) -> 'View':
def active_view_in_group(self, group: int) -> 'Optional[View]':
...

def sheets_in_group(self, group: int) -> 'List[Sheet]':
Expand Down

0 comments on commit f07c307

Please sign in to comment.