Bug on GetCustomBlockTypes without exclusion or invalid pou fixed
authorlbessard
Fri, 22 Aug 2008 17:18:12 +0200
changeset 238 389f2046e495
parent 237 097e8ee006cb
child 239 d12779e971bd
Bug on GetCustomBlockTypes without exclusion or invalid pou fixed
plcopen/plcopen.py
--- a/plcopen/plcopen.py	Fri Aug 22 13:52:19 2008 +0200
+++ b/plcopen/plcopen.py	Fri Aug 22 17:18:12 2008 +0200
@@ -313,7 +313,7 @@
         if pou_type != "program":
             block_infos = {"name" : pou_name, "type" : pou_type, "extensible" : False,
                            "inputs" : [], "outputs" : [], "comment" : "",
-                           "generate" : generate_block, "initialise" : initialise_block }
+                           "generate" : generate_block, "initialise" : initialise_block}
             if pou.getinterface():
                 for type, varlist in pou.getvars():
                     if type == "InOut":
@@ -494,8 +494,11 @@
 
     # Return Block types checking for recursion
     def GetCustomBlockTypes(self, exclude = ""):
-        pou = self.getpou(exclude)
-        type = pou.getpouType()
+        type = None
+        if exclude != "":
+            pou = self.getpou(exclude)
+            if pou is not None:
+                type = pou.getpouType()
         customblocktypes = []
         for customblocktype in self.CustomBlockTypes:
             if customblocktype["name"] != exclude and not self.ElementIsUsedBy(exclude, customblocktype["name"]) and not (type == "function" and customblocktype["type"] != "function"):