From cab361310e0e46a19b91bb6aeab25be3e060ce6d Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Fri, 26 Apr 2002 09:27:45 +0000 Subject: [PATCH] Ensure that the choice is always valid, thus fixing a crash. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4072 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/xforms/ChangeLog | 4 ++++ src/frontends/xforms/FormCitation.C | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 02a153899f..91d518e311 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,7 @@ +2002-04-22 Angus Leeming + + * FormCitation.C (apply, input): ensure that the choice is always valid. + 2002-04-23 Juergen Spitzmueller * FormBibtex.C: Do not use a blank after the comma for multiple diff --git a/src/frontends/xforms/FormCitation.C b/src/frontends/xforms/FormCitation.C index 23f7994250..9dfbb49bb3 100644 --- a/src/frontends/xforms/FormCitation.C +++ b/src/frontends/xforms/FormCitation.C @@ -126,7 +126,7 @@ void FormCitation::apply() ControlCitation::getCiteStyles(); int const choice = - fl_get_choice(dialog_->choice_style) - 1; + std::max(0, fl_get_choice(dialog_->choice_style) - 1); bool const full = fl_get_button(dialog_->check_full_author_list); bool const force = @@ -429,7 +429,7 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long) currentCitekey = citekeys[0]; if (topCitekey != currentCitekey) { - int choice = fl_get_choice(dialog_->choice_style); + int choice = std::max(1, fl_get_choice(dialog_->choice_style)); fillChoice(dialog_.get(), controller().getCiteStrings(currentCitekey)); fl_set_choice(dialog_->choice_style, choice);