changeset 2064:0e4d2e07d338

choice5: don't crash in the absence of choices
author corvid <corvid@lavabit.com>
date Sun, 29 May 2011 20:14:42 +0000
parents 93b03ac0add6
children f5114f4659b6
files src/dialog.cc
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialog.cc	Fri May 27 22:42:02 2011 +0200
+++ b/src/dialog.cc	Sun May 29 20:14:42 2011 +0000
@@ -176,6 +176,11 @@
    txt[4] = alt4; txt[5] = alt5;
    for (int i=1; txt[i]; ++i, ++nb)
       ;
+
+   if (!nb) {
+      MSG_ERR("a_Dialog_choice5: No choices.\n");
+      return choice5_answer;
+   }
    ww = 140 + nb*(bw+10);
 
    Fl_Window *window = new Fl_Window(ww,wh,"Choice5");