Skip to content

Commit b322a50

Browse files
committed
Prevent create from failing when path initializing to current with no view
1 parent c5d9f9a commit b322a50

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

advanced_new_file/commands/command_base.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,11 @@ def __parse_path_setting(self, setting, index_setting):
9393
if setting == "home":
9494
root = os.path.expanduser("~/")
9595
elif setting == "current":
96-
filename = self.view.file_name()
97-
if filename is not None:
98-
root = os.path.dirname(filename)
99-
else:
96+
if self.view is not None:
97+
filename = self.view.file_name()
98+
if filename is not None:
99+
root = os.path.dirname(filename)
100+
if root is None:
100101
root = os.path.expanduser("~/")
101102
elif setting == "project_folder":
102103
folder_index = self.settings.get(index_setting)

0 commit comments

Comments
 (0)