plcopen/plcopen.py
changeset 89 a6ff2b3fcc25
parent 77 346a43f179a5
child 94 e7f5a251f251
--- a/plcopen/plcopen.py	Mon Sep 10 09:00:50 2007 +0200
+++ b/plcopen/plcopen.py	Mon Sep 10 16:12:29 2007 +0200
@@ -442,14 +442,16 @@
             for instance in self.getInstances():
                 if isinstance(instance, PLCOpenClasses["block"]) and instance.getInstanceName() == name:
                     return True
-            for transition in self.transitions.getTransition():
-                result = transition.hasBlock(name)
-                if result:
-                    return result
-            for action in self.actions.getAction():
-                result = action.hasBlock(name)
-                if result:
-                    return result
+            if self.transitions:
+                for transition in self.transitions.getTransition():
+                    result = transition.hasBlock(name)
+                    if result:
+                        return result
+            if self.actions:
+                for action in self.actions.getAction():
+                    result = action.hasBlock(name)
+                    if result:
+                        return result
         return False
     setattr(cls, "hasBlock", hasBlock)