comparison src/xdisp.c @ 41194:e0f2d5ffc822

(tool_bar_item_info): Avoid calling Fget_text_property with invalid position.
author Gerd Moellmann <gerd@gnu.org>
date Sat, 17 Nov 2001 10:46:24 +0000
parents 47a681ab7ec7
children ded3ee1f7b91
comparison
equal deleted inserted replaced
41193:1377d461b09c 41194:e0f2d5ffc822
7933 struct glyph *glyph; 7933 struct glyph *glyph;
7934 int *prop_idx; 7934 int *prop_idx;
7935 { 7935 {
7936 Lisp_Object prop; 7936 Lisp_Object prop;
7937 int success_p; 7937 int success_p;
7938 int charpos;
7939
7940 /* This function can be called asynchronously, which means we must
7941 exclude any possibility that Fget_text_property signals an
7942 error. */
7943 charpos = min (XSTRING (f->current_tool_bar_string)->size, glyph->charpos);
7944 charpos = max (0, charpos);
7938 7945
7939 /* Get the text property `menu-item' at pos. The value of that 7946 /* Get the text property `menu-item' at pos. The value of that
7940 property is the start index of this item's properties in 7947 property is the start index of this item's properties in
7941 F->tool_bar_items. */ 7948 F->tool_bar_items. */
7942 prop = Fget_text_property (make_number (glyph->charpos), 7949 prop = Fget_text_property (make_number (charpos),
7943 Qmenu_item, f->current_tool_bar_string); 7950 Qmenu_item, f->current_tool_bar_string);
7944 if (INTEGERP (prop)) 7951 if (INTEGERP (prop))
7945 { 7952 {
7946 *prop_idx = XINT (prop); 7953 *prop_idx = XINT (prop);
7947 success_p = 1; 7954 success_p = 1;