Skip to content

Commit 37f1555

Browse files
committed
check for 0 maximum
1 parent 10062da commit 37f1555

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

DoomLauncher/Controls/CProgressBar.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ public CProgressBar()
1313
protected override void OnPaint(PaintEventArgs e)
1414
{
1515
Rectangle rect = e.ClipRectangle;
16-
1716
DpiScale dpiScale = new DpiScale(e.Graphics);
1817
int padX = dpiScale.ScaleIntX(2);
1918
int padY = dpiScale.ScaleIntY(2);
2019

21-
rect.Width = (int)(rect.Width * ((double)Value / Maximum)) - (padX*2);
20+
if (Maximum != 0)
21+
rect.Width = (int)(rect.Width * ((double)Value / Maximum));
22+
rect.Width -= (padX * 2);
23+
2224
if (ProgressBarRenderer.IsSupported)
2325
ProgressBarRenderer.DrawHorizontalBar(e.Graphics, e.ClipRectangle);
2426
rect.Height -= padY * 2;

0 commit comments

Comments
 (0)