diff options
| author | Po Lu | 2022-02-17 02:32:55 +0000 |
|---|---|---|
| committer | Po Lu | 2022-02-17 02:32:55 +0000 |
| commit | 99d6536c326a4df3bfb964f421edc2a005deb851 (patch) | |
| tree | d9d44b990411650eef5eace5f735293a90f63963 /src | |
| parent | 74c07733698b95eb455edcafab8634a700a3194f (diff) | |
| download | emacs-99d6536c326a4df3bfb964f421edc2a005deb851.tar.gz emacs-99d6536c326a4df3bfb964f421edc2a005deb851.zip | |
Fix SIGFPE on some fonts when calculating their average width on Haiku
* src/haiku_font_support.cc (estimate_font_ascii): Avoid divison
by zero.
Diffstat (limited to 'src')
| -rw-r--r-- | src/haiku_font_support.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/haiku_font_support.cc b/src/haiku_font_support.cc index 3930cd965f6..549c54d8649 100644 --- a/src/haiku_font_support.cc +++ b/src/haiku_font_support.cc | |||
| @@ -68,7 +68,11 @@ estimate_font_ascii (BFont *font, int *max_width, | |||
| 68 | 68 | ||
| 69 | *min_width = min; | 69 | *min_width = min; |
| 70 | *max_width = max; | 70 | *max_width = max; |
| 71 | *avg_width = total / count; | 71 | |
| 72 | if (count) | ||
| 73 | *avg_width = total / count; | ||
| 74 | else | ||
| 75 | *avg_width = 0; | ||
| 72 | } | 76 | } |
| 73 | 77 | ||
| 74 | void | 78 | void |