Fix addon crash when trying listdir a directory we have no permission to.

This commit is contained in:
Bastien Montagne 2014-07-30 15:35:19 +02:00
parent 74758576fc
commit 3a58c4679a
1 changed files with 4 additions and 1 deletions

View File

@ -219,7 +219,10 @@ def resolve_ncase(path):
# we are expecting 'dirpath' to be a directory, but it could be a file
if _os.path.isdir(dirpath):
files = _os.listdir(dirpath)
try:
files = _os.listdir(dirpath)
except PermissionError: # We might not have the permission to list dirpath...
return path, False
else:
return path, False