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:
parent
74c0773369
commit
99d6536c32
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue