projects
/
emacs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
74c0773
)
Fix SIGFPE on some fonts when calculating their average width on Haiku
author
Po Lu
<luangruo@yahoo.com>
Thu, 17 Feb 2022 02:32:55 +0000
(
02:32
+0000)
committer
Po Lu
<luangruo@yahoo.com>
Thu, 17 Feb 2022 02:32:55 +0000
(
02:32
+0000)
* src/haiku_font_support.cc (estimate_font_ascii): Avoid divison
by zero.
src/haiku_font_support.cc
patch
|
blob
|
history
diff --git
a/src/haiku_font_support.cc
b/src/haiku_font_support.cc
index 3930cd965f621050e841c56857bd1dff61636122..549c54d86494cf5c7016912cc84f4f2e927506ea 100644
(file)
--- a/
src/haiku_font_support.cc
+++ b/
src/haiku_font_support.cc
@@
-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