Skip to content

Commit

Permalink
fix: nonetype error when creating new folder (#57)
Browse files Browse the repository at this point in the history
The new command uses the active view file name as the path from which to
construct the new folder, but when the view is empty there is no real
file on disk and the file name is None.

The `os.path` functions like `isdir` and `exists` raise a NoneType
exception when given None. This patch adds a NoneType check.

Close #55
Re #56
  • Loading branch information
gerardroche authored Jul 20, 2024
1 parent 27ef796 commit 3e38f62
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion SideBar.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def run(self, paths, context=""):
source = self.get_path(paths)
select_extension = False

if not os.path.exists(source):
if source is None or not os.path.exists(source):
self.window.status_message('No path to create a new file from.')
return

Expand Down

0 comments on commit 3e38f62

Please sign in to comment.