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
This commit is contained in:
Angus Leeming 2002-04-26 09:27:45 +00:00
parent 66c63a89ef
commit cab361310e
2 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2002-04-22 Angus Leeming <a.leeming@ic.ac.uk>
* FormCitation.C (apply, input): ensure that the choice is always valid.
2002-04-23 Juergen Spitzmueller <j.spitzmueller@gmx.de> 2002-04-23 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* FormBibtex.C: Do not use a blank after the comma for multiple * FormBibtex.C: Do not use a blank after the comma for multiple

View File

@ -126,7 +126,7 @@ void FormCitation::apply()
ControlCitation::getCiteStyles(); ControlCitation::getCiteStyles();
int const choice = int const choice =
fl_get_choice(dialog_->choice_style) - 1; std::max(0, fl_get_choice(dialog_->choice_style) - 1);
bool const full = bool const full =
fl_get_button(dialog_->check_full_author_list); fl_get_button(dialog_->check_full_author_list);
bool const force = bool const force =
@ -429,7 +429,7 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
currentCitekey = citekeys[0]; currentCitekey = citekeys[0];
if (topCitekey != currentCitekey) { 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(), fillChoice(dialog_.get(),
controller().getCiteStrings(currentCitekey)); controller().getCiteStrings(currentCitekey));
fl_set_choice(dialog_->choice_style, choice); fl_set_choice(dialog_->choice_style, choice);