Fixed two exceptions happening when interacting with viewer(s) in debug mode, when debug data is still not initialized.
authorEdouard Tisserant
Wed, 06 Oct 2021 10:45:06 +0200
changeset 3333 dd49e4055a10
parent 3319 e6c758e41f82
child 3334 d7e0ddb5974b
Fixed two exceptions happening when interacting with viewer(s) in debug mode, when debug data is still not initialized.
graphics/GraphicCommons.py
graphics/LD_Objects.py
--- a/graphics/GraphicCommons.py	Thu Sep 16 09:40:36 2021 +0200
+++ b/graphics/GraphicCommons.py	Wed Oct 06 10:45:06 2021 +0200
@@ -1063,6 +1063,8 @@
 
     # Returns the RedrawRect
     def GetRedrawRect(self, movex=0, movey=0):
+        if self.ParentBlock == None:
+            return None
         parent_pos = self.ParentBlock.GetPosition()
         x = min(parent_pos[0] + self.Pos.x, parent_pos[0] + self.Pos.x + self.Direction[0] * CONNECTOR_SIZE)
         y = min(parent_pos[1] + self.Pos.y, parent_pos[1] + self.Pos.y + self.Direction[1] * CONNECTOR_SIZE)
--- a/graphics/LD_Objects.py	Thu Sep 16 09:40:36 2021 +0200
+++ b/graphics/LD_Objects.py	Wed Oct 06 10:45:06 2021 +0200
@@ -405,6 +405,8 @@
             if self.Value is None:
                 self.Value = False
             spreading = self.Input.ReceivingCurrent()
+            if spreading == "undefined":
+                spreading = False
             if self.Type == CONTACT_NORMAL:
                 spreading &= self.Value
             elif self.Type == CONTACT_REVERSE: