Skip to content

Commit

Permalink
FvwmPager: fix division by zero
Browse files Browse the repository at this point in the history
When resizing FvwmPager, don't error out with a division by zero.  This
can happen when a window is overlapped with itself while resizing.
  • Loading branch information
ThomasAdam committed Aug 29, 2023
1 parent 4d5a697 commit 0dae3d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/FvwmPager/x_pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ static rectangle CalcGeom(PagerWindow *t, bool is_icon)
page_w = icon.width;
page_w = page_w / m->virtual_scr.VxPages;

if (page_w == 0)
page_w = 1;

rec.width = MinSize;
if (rec.x > page_w - MinSize &&
(rec.x + rec.width)%page_w < MinSize)
Expand All @@ -249,6 +252,9 @@ static rectangle CalcGeom(PagerWindow *t, bool is_icon)
page_h = icon.height;
page_h = page_h / m->virtual_scr.VyPages;

if (page_h == 0)
page_h = 1;

rec.height = MinSize;
if (rec.y > page_h - MinSize &&
(rec.y + rec.height)%page_h < MinSize)
Expand Down

0 comments on commit 0dae3d3

Please sign in to comment.