Skip to content

Commit c3258de

Browse files
committed
rendlay: guard against possible divide by 0
1 parent 465980c commit c3258de

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/emu/rendlay.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3715,7 +3715,8 @@ void layout_element::component::draw_text(
37153715
float aspect = 1.0;
37163716
if (align == 3 || width > bounds.width())
37173717
{
3718-
aspect = float(bounds.width()) / float(width);
3718+
if (width != 0)
3719+
aspect = float(bounds.width()) / float(width);
37193720
width = bounds.width();
37203721
}
37213722

@@ -3732,8 +3733,8 @@ void layout_element::component::draw_text(
37323733
case 2:
37333734
curx = bounds.left() + bounds.width() - width;
37343735
break;
3735-
3736-
// stretch
3736+
3737+
// stretch (aligned both left & right)
37373738
case 3:
37383739
curx = bounds.left();
37393740
break;

0 commit comments

Comments
 (0)