Fixing ifc git poll errors if .ifc file is not yet saved

Errors:
Traceback (most recent call last):
  File "\Blender\3.6\scripts\addons\blenderbim\bim\module\ifcgit\operator.py", line 20, in poll
    if not os.path.isfile(path_ifc):
  File "\Blender\3.6\python\lib\genericpath.py", line 30, in isfile
    st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
Traceback (most recent call last):
  File "\Blender\3.6\scripts\addons\blenderbim\bim\module\ifcgit\operator.py", line 48, in poll
    if not os.path.isfile(path_ifc):
  File "\Blender\3.6\python\lib\genericpath.py", line 30, in isfile
    st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
This commit is contained in:
Andrej730
2023-06-30 13:42:01 +05:00
parent 0df62d5746
commit 18d26df24e
@@ -17,7 +17,7 @@ class CreateRepo(bpy.types.Operator):
def poll(cls, context):
IfcGitData.make_sure_is_loaded()
path_ifc = IfcGitData.data["path_ifc"]
if not os.path.isfile(path_ifc):
if not path_ifc or not os.path.isfile(path_ifc):
return False
if IfcGitData.data["repo"]:
# repo already exists
@@ -45,7 +45,7 @@ class AddFileToRepo(bpy.types.Operator):
def poll(cls, context):
IfcGitData.make_sure_is_loaded()
path_ifc = IfcGitData.data["path_ifc"]
if not os.path.isfile(path_ifc):
if not path_ifc or not os.path.isfile(path_ifc):
return False
if not IfcGitData.data["repo"]:
# repo doesn't exist