Fix SIGFPE on some fonts when calculating their average width on Haiku

* src/haiku_font_support.cc (estimate_font_ascii): Avoid divison
by zero.
This commit is contained in:
Po Lu 2022-02-17 02:32:55 +00:00
parent 74c0773369
commit 99d6536c32

View file

@ -68,7 +68,11 @@ estimate_font_ascii (BFont *font, int *max_width,
*min_width = min;
*max_width = max;
*avg_width = total / count;
if (count)
*avg_width = total / count;
else
*avg_width = 0;
}
void