Skip to content

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Source/RunActivity/Viewer3D/Debugging/DebugViewerBetaForm.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,11 @@ private void InitializeData()
235235
/// </summary>
236236
public void InitializeImage()
237237
{
238+
// When minimizing the window, `mapCanvas.Width` gets reported as 0
239+
// This crashes `System.Drawing.dll`, hence the check below
240+
if (mapCanvas.Width <= 0 || mapCanvas.Height <= 0) return;
238241

239-
if (mapCanvas.Image != null)
240-
{
241-
mapCanvas.Image.Dispose();
242-
}
243-
242+
mapCanvas.Image?.Dispose();
244243
mapCanvas.Image = new Bitmap(mapCanvas.Width, mapCanvas.Height);
245244
}
246245
#endregion
@@ -1747,6 +1746,7 @@ private void rotateThemesButton_Click(object sender, EventArgs e)
17471746
ApplyThemeRecursively(this);
17481747
MapCanvasColor = Theme.MapCanvasColor;
17491748
TrackPen.Color = Theme.TrackColor;
1749+
InitializeImage();
17501750
}
17511751

17521752
private void DispatchViewerBeta_FormClosing(object sender, FormClosingEventArgs e)

0 commit comments

Comments
 (0)