diff --git a/ChangeLog b/ChangeLog index 78a2d9ef58..e9748a15e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-01-15 Jean-Marc Lasgouttes + + * src/mathed/math_panel.C (deco_cb): fix crash when clicking on + non-existing decoration. + 2000-12-11 John Levon * README: add mention of broken ghostscript versions, remove diff --git a/src/mathed/math_panel.C b/src/mathed/math_panel.C index 6c10630a86..fea5bbab0e 100644 --- a/src/mathed/math_panel.C +++ b/src/mathed/math_panel.C @@ -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; }