aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/character.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/character.c b/src/character.c
index b17f44b1422..8920da2748f 100644
--- a/src/character.c
+++ b/src/character.c
@@ -289,15 +289,18 @@ char_width (int c, struct Lisp_Char_Table *dp)
289 if (VECTORP (disp)) 289 if (VECTORP (disp))
290 for (i = 0, width = 0; i < ASIZE (disp); i++) 290 for (i = 0, width = 0; i < ASIZE (disp); i++)
291 { 291 {
292 int c; 292 int c = -1;
293 ch = AREF (disp, i); 293 ch = AREF (disp, i);
294 if (GLYPH_CODE_P (ch)) 294 if (GLYPH_CODE_P (ch))
295 c = GLYPH_CODE_CHAR (ch); 295 c = GLYPH_CODE_CHAR (ch);
296 else if (CHARACTERP (ch)) 296 else if (CHARACTERP (ch))
297 c = XFASTINT (ch); 297 c = XFASTINT (ch);
298 int w = CHARACTER_WIDTH (c); 298 if (c >= 0)
299 if (INT_ADD_WRAPV (width, w, &width)) 299 {
300 string_overflow (); 300 int w = CHARACTER_WIDTH (c);
301 if (INT_ADD_WRAPV (width, w, &width))
302 string_overflow ();
303 }
301 } 304 }
302 } 305 }
303 return width; 306 return width;