From da45328f6f9b35cbbdc7167d7faadb6a07634bdb Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 3 Dec 2024 15:30:03 +0100 Subject: [PATCH] BIM: Fixed lock button with no doc - Fixes #18191 --- src/Mod/BIM/nativeifc/ifc_status.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Mod/BIM/nativeifc/ifc_status.py b/src/Mod/BIM/nativeifc/ifc_status.py index fc4ad5a68cec..ec2a1f8ce2fc 100644 --- a/src/Mod/BIM/nativeifc/ifc_status.py +++ b/src/Mod/BIM/nativeifc/ifc_status.py @@ -327,6 +327,8 @@ def unlock_document(): from nativeifc import ifc_tools # lazy loading doc = FreeCAD.ActiveDocument + if not doc: + return if "IfcFilePath" in doc.PropertiesList: # this is a locked document doc.openTransaction("Unlock document") @@ -356,6 +358,8 @@ def lock_document(): from PySide import QtCore doc = FreeCAD.ActiveDocument + if not doc: + return products = [] spatial = [] ifcfile = None