Bläddra i källkod

Bugfix: Fix integer overflow when animation window is invisible (height = 0)
- Was causing a hang as it caused a negative int to turn into a very large uint

BearishSun 6 år sedan
förälder
incheckning
2b83759ce4
1 ändrade filer med 5 tillägg och 5 borttagningar
  1. 5 5
      Source/EditorManaged/Windows/Animation/GUICurveEditor.cs

+ 5 - 5
Source/EditorManaged/Windows/Animation/GUICurveEditor.cs

@@ -340,7 +340,7 @@ namespace bs.Editor
 
 
             guiCurveDrawing = new GUICurves(drawOptions);
             guiCurveDrawing = new GUICurves(drawOptions);
             guiCurveDrawing.SetWidth(this.width);
             guiCurveDrawing.SetWidth(this.width);
-            guiCurveDrawing.SetHeight(this.height - TIMELINE_HEIGHT - eventsHeaderHeight - VERT_PADDING * 2);
+            guiCurveDrawing.SetHeight(Math.Max(0, this.height - TIMELINE_HEIGHT - eventsHeaderHeight - VERT_PADDING * 2));
             guiCurveDrawing.SetRange(60.0f, 20.0f);
             guiCurveDrawing.SetRange(60.0f, 20.0f);
             guiCurveDrawing.Curves = GetPlainCurveDrawInfos();
             guiCurveDrawing.Curves = GetPlainCurveDrawInfos();
             drawingPanel.AddElement(guiCurveDrawing);
             drawingPanel.AddElement(guiCurveDrawing);
@@ -348,8 +348,8 @@ namespace bs.Editor
             GUIPanel sidebarPanel = mainPanel.AddPanel(-10);
             GUIPanel sidebarPanel = mainPanel.AddPanel(-10);
             sidebarPanel.SetPosition(0, TIMELINE_HEIGHT + eventsHeaderHeight + VERT_PADDING);
             sidebarPanel.SetPosition(0, TIMELINE_HEIGHT + eventsHeaderHeight + VERT_PADDING);
 
 
-            guiSidebar = new GUIGraphValues(sidebarPanel, SIDEBAR_WIDTH, this.height - TIMELINE_HEIGHT - 
-                eventsHeaderHeight - VERT_PADDING * 2);
+            guiSidebar = new GUIGraphValues(sidebarPanel, SIDEBAR_WIDTH, 
+                Math.Max(0, this.height - TIMELINE_HEIGHT - eventsHeaderHeight - VERT_PADDING * 2));
             guiSidebar.SetRange(-10.0f, 10.0f);
             guiSidebar.SetRange(-10.0f, 10.0f);
 
 
             horzScrollBar.SetWidth(this.width);
             horzScrollBar.SetWidth(this.width);
@@ -390,8 +390,8 @@ namespace bs.Editor
 
 
             guiTimeline.SetSize(this.width, TIMELINE_HEIGHT);
             guiTimeline.SetSize(this.width, TIMELINE_HEIGHT);
             guiCurveDrawing.SetWidth(this.width);
             guiCurveDrawing.SetWidth(this.width);
-            guiCurveDrawing.SetHeight(this.height - TIMELINE_HEIGHT - eventsHeaderHeight);
-            guiSidebar.SetSize(SIDEBAR_WIDTH, this.height - TIMELINE_HEIGHT - eventsHeaderHeight);
+            guiCurveDrawing.SetHeight(Math.Max(0, this.height - TIMELINE_HEIGHT - eventsHeaderHeight));
+            guiSidebar.SetSize(SIDEBAR_WIDTH, Math.Max(0, this.height - TIMELINE_HEIGHT - eventsHeaderHeight));
 
 
             timelineBackground.Bounds = new Rect2I(0, 0, this.width, TIMELINE_HEIGHT + VERT_PADDING);
             timelineBackground.Bounds = new Rect2I(0, 0, this.width, TIMELINE_HEIGHT + VERT_PADDING);