Fixed bug structures.py crashing with non-connected blocks.
authoretisserant
Mon, 19 Jan 2009 08:21:41 +0100
changeset 305 0ed2b61de43e
parent 304 2df3d31d8059
child 306 eecc53781498
Fixed bug structures.py crashing with non-connected blocks.
plcopen/structures.py
--- a/plcopen/structures.py	Fri Jan 16 13:22:07 2009 +0100
+++ b/plcopen/structures.py	Mon Jan 19 08:21:41 2009 +0100
@@ -34,8 +34,11 @@
                      "L" : ["LINT", "ULINT", "LREAL", "LWORD"]} 
 
 # Helper for emulate join on element list
-def JoinList(separator, list):
-    return reduce(lambda x, y: x + separator + y, list)
+def JoinList(separator, mylist):
+    if len(mylist) > 0 :
+        return reduce(lambda x, y: x + separator + y, mylist)
+    else :
+        return mylist
 
 def generate_block(generator, block, body, link, order=False):
     body_type = body.getcontent()["name"]