Fix crash on the decoration popup

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/lyx-1_1_5@1337 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-01-15 14:18:58 +00:00
parent 389efe9e5a
commit 0442169830
2 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2001-01-15 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/mathed/math_panel.C (deco_cb): fix crash when clicking on
non-existing decoration.
2000-12-11 John Levon <moz@compsoc.man.ac.uk>
* README: add mention of broken ghostscript versions, remove

View File

@ -242,8 +242,14 @@ void deco_cb(FL_OBJECT *, long data)
case MM_OK:
{
int i = fl_get_bmtable(fd_deco->menu);
lyxfunc->Dispatch(LFUN_INSERT_MATH, deco_code[i]);
if (data == MM_APPLY) break;
// ideally the callback should not be called if the index is
// greater than the maxitem of the bmtable, but I do not know
// how to enforce that (JMarc)
if (i <= sizeof(deco_code)/sizeof(deco_code[0])) {
lyxfunc->Dispatch(LFUN_INSERT_MATH, deco_code[i]);
if (data == MM_APPLY) break;
}
else break;
}
case MM_CLOSE: fl_hide_form(fd_deco->deco); break;
}