# HG changeset patch
# User Laurent Bessard
# Date 1380479972 -7200
# Node ID 1b9610fc1e6beef46ca5818925fa55bad95bf2e2
# Parent  b0c2c4e1c1f1e584066986f9eaeaeb7f6c9f1292
Fixed bug when loading graphic pou connection between blocks and no points for drawing wire are defined

diff -r b0c2c4e1c1f1 -r 1b9610fc1e6b editors/Viewer.py
--- a/editors/Viewer.py	Sun Sep 29 20:17:05 2013 +0200
+++ b/editors/Viewer.py	Sun Sep 29 20:39:32 2013 +0200
@@ -1330,10 +1330,20 @@
                 continue
             
             points = link["points"]
-            end_connector = connected.GetConnector(wx.Point(points[-1][0], points[-1][1]), link["formalParameter"])
+            end_connector = connected.GetConnector(
+                wx.Point(points[-1][0], points[-1][1])
+                if len(points) > 0 else wx.Point(0, 0), 
+                link["formalParameter"])
             if end_connector is not None:
-                wire = Wire(self)
-                wire.SetPoints(points)
+                if len(points) > 0:
+                    wire = Wire(self)
+                    wire.SetPoints(points)
+                else:
+                    wire = Wire(self,
+                        [wx.Point(*start_connector.GetPosition()), 
+                         start_connector.GetDirection()],
+                        [wx.Point(*end_connector.GetPosition()),
+                         end_connector.GetDirection()])
                 start_connector.Connect((wire, 0), False)
                 end_connector.Connect((wire, -1), False)
                 wire.ConnectStartPoint(None, start_connector)