# HG changeset patch # User lbessard # Date 1219418292 -7200 # Node ID 389f2046e4957352bc1295bf6177a6621f67f510 # Parent 097e8ee006cb04a9b60cd534142d7e2a46746ce8 Bug on GetCustomBlockTypes without exclusion or invalid pou fixed diff -r 097e8ee006cb -r 389f2046e495 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"):