Mercurial > hg > xemacs-beta
comparison src/window.c @ 3676:3ef0aaf3dc34
[xemacs-hg @ 2006-11-12 13:40:04 by aidan]
Prevent a crash if the ASCII charset registries match nothing.
author | aidan |
---|---|
date | Sun, 12 Nov 2006 13:40:09 +0000 |
parents | 4d52aea479a2 |
children | 719ceea8b3cb |
comparison
equal
deleted
inserted
replaced
3675:0492077a2e85 | 3676:3ef0aaf3dc34 |
---|---|
4248 static int | 4248 static int |
4249 window_pixel_width_to_char_width (struct window *w, int pixel_width, | 4249 window_pixel_width_to_char_width (struct window *w, int pixel_width, |
4250 int include_margins_p) | 4250 int include_margins_p) |
4251 { | 4251 { |
4252 int avail_width; | 4252 int avail_width; |
4253 int char_width; | 4253 int char_width = 0; |
4254 int defheight, defwidth; | 4254 int defheight, defwidth; |
4255 Lisp_Object window = wrap_window (w); | 4255 Lisp_Object window = wrap_window (w); |
4256 | 4256 |
4257 | 4257 |
4258 avail_width = (pixel_width - | 4258 avail_width = (pixel_width - |
4261 (include_margins_p ? 0 : window_left_margin_width (w)) - | 4261 (include_margins_p ? 0 : window_left_margin_width (w)) - |
4262 (include_margins_p ? 0 : window_right_margin_width (w))); | 4262 (include_margins_p ? 0 : window_right_margin_width (w))); |
4263 | 4263 |
4264 default_face_height_and_width (window, &defheight, &defwidth); | 4264 default_face_height_and_width (window, &defheight, &defwidth); |
4265 | 4265 |
4266 char_width = (avail_width / defwidth); | 4266 if (defwidth) |
4267 char_width = (avail_width / defwidth); | |
4267 | 4268 |
4268 /* It's the calling function's responsibility to check these values | 4269 /* It's the calling function's responsibility to check these values |
4269 and make sure they're not out of range. | 4270 and make sure they're not out of range. |
4270 | 4271 |
4271 #### We need to go through the calling functions and actually | 4272 #### We need to go through the calling functions and actually |