diff --git a/gnu/lib/libdialog/checklist.c b/gnu/lib/libdialog/checklist.c index f802f33505c5..cc83d258b5ff 100644 --- a/gnu/lib/libdialog/checklist.c +++ b/gnu/lib/libdialog/checklist.c @@ -59,6 +59,11 @@ int dialog_checklist(unsigned char *title, unsigned char *prompt, int height, in draw_shadow(stdscr, y, x, height, width); #endif dialog = newwin(height, width, y, x); + if (dialog == NULL) { + endwin(); + fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); + exit(1); + } keypad(dialog, TRUE); draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); @@ -91,6 +96,11 @@ int dialog_checklist(unsigned char *title, unsigned char *prompt, int height, in /* create new window for the list */ list = subwin(dialog, list_height, list_width, y + box_y + 1, x + box_x + 1); + if (list == NULL) { + endwin(); + fprintf(stderr, "\nsubwin(dialog,%d,%d,%d,%d) failed, maybe wrong dims\n", list_height,list_width,y+box_y+1,x+box_x+1); + exit(1); + } keypad(list, TRUE); /* draw a box around the list items */ diff --git a/gnu/lib/libdialog/inputbox.c b/gnu/lib/libdialog/inputbox.c index bf423c9c8261..8bf384dcf9e8 100644 --- a/gnu/lib/libdialog/inputbox.c +++ b/gnu/lib/libdialog/inputbox.c @@ -42,6 +42,11 @@ int dialog_inputbox(unsigned char *title, unsigned char *prompt, int height, int draw_shadow(stdscr, y, x, height, width); #endif dialog = newwin(height, width, y, x); + if (dialog == NULL) { + endwin(); + fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); + exit(1); + } keypad(dialog, TRUE); draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); diff --git a/gnu/lib/libdialog/menubox.c b/gnu/lib/libdialog/menubox.c index 332dfa75c15c..5aa5b5b11168 100644 --- a/gnu/lib/libdialog/menubox.c +++ b/gnu/lib/libdialog/menubox.c @@ -49,6 +49,11 @@ int dialog_menu(unsigned char *title, unsigned char *prompt, int height, int wid draw_shadow(stdscr, y, x, height, width); #endif dialog = newwin(height, width, y, x); + if (dialog == NULL) { + endwin(); + fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); + exit(1); + } keypad(dialog, TRUE); draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); @@ -81,6 +86,11 @@ int dialog_menu(unsigned char *title, unsigned char *prompt, int height, int wid /* create new window for the menu */ menu = subwin(dialog, menu_height, menu_width, y + box_y + 1, x + box_x + 1); + if (menu == NULL) { + endwin(); + fprintf(stderr, "\nsubwin(dialog,%d,%d,%d,%d) failed, maybe wrong dims\n", menu_height,menu_width,y+box_y+1,x+box_x+1); + exit(1); + } keypad(menu, TRUE); /* draw a box around the menu items */ diff --git a/gnu/lib/libdialog/msgbox.c b/gnu/lib/libdialog/msgbox.c index c56b58b41c8d..e405f3b5a26a 100644 --- a/gnu/lib/libdialog/msgbox.c +++ b/gnu/lib/libdialog/msgbox.c @@ -41,6 +41,11 @@ int dialog_msgbox(unsigned char *title, unsigned char *prompt, int height, int w draw_shadow(stdscr, y, x, height, width); #endif dialog = newwin(height, width, y, x); + if (dialog == NULL) { + endwin(); + fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); + exit(1); + } keypad(dialog, TRUE); draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); diff --git a/gnu/lib/libdialog/prgbox.c b/gnu/lib/libdialog/prgbox.c index d95ffdb1b04c..db825890a301 100644 --- a/gnu/lib/libdialog/prgbox.c +++ b/gnu/lib/libdialog/prgbox.c @@ -43,6 +43,11 @@ int dialog_prgbox(unsigned char *title, const char *line, int height, int width, draw_shadow(stdscr, y, x, height, width); #endif dialog = newwin(height, width, y, x); + if (dialog == NULL) { + endwin(); + fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); + exit(1); + } keypad(dialog, TRUE); draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); diff --git a/gnu/lib/libdialog/radiolist.c b/gnu/lib/libdialog/radiolist.c index 3618e6867d4c..5a2151861d87 100644 --- a/gnu/lib/libdialog/radiolist.c +++ b/gnu/lib/libdialog/radiolist.c @@ -67,6 +67,11 @@ int dialog_radiolist(char *title, char *prompt, int height, int width, int list_ draw_shadow(stdscr, y, x, height, width); #endif dialog = newwin(height, width, y, x); + if (dialog == NULL) { + endwin(); + fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); + exit(1); + } keypad(dialog, TRUE); draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); @@ -99,6 +104,11 @@ int dialog_radiolist(char *title, char *prompt, int height, int width, int list_ /* create new window for the list */ list = subwin(dialog, list_height, list_width, y + box_y + 1, x + box_x + 1); + if (list == NULL) { + endwin(); + fprintf(stderr, "\nsubwin(dialog,%d,%d,%d,%d) failed, maybe wrong dims\n", list_height,list_width,y+box_y+1,x+box_x+1); + exit(1); + } keypad(list, TRUE); /* draw a box around the list items */ diff --git a/gnu/lib/libdialog/textbox.c b/gnu/lib/libdialog/textbox.c index cb874743b6a7..670ea49fe32c 100644 --- a/gnu/lib/libdialog/textbox.c +++ b/gnu/lib/libdialog/textbox.c @@ -92,11 +92,21 @@ int dialog_textbox(unsigned char *title, unsigned char *file, int height, int wi draw_shadow(stdscr, y, x, height, width); #endif dialog = newwin(height, width, y, x); + if (dialog == NULL) { + endwin(); + fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); + exit(1); + } keypad(dialog, TRUE); /* Create window for text region, used for scrolling text */ /* text = newwin(height-4, width-2, y+1, x+1); */ text = subwin(dialog, height-4, width-2, y+1, x+1); + if (text == NULL) { + endwin(); + fprintf(stderr, "\nsubwin(dialog,%d,%d,%d,%d) failed, maybe wrong dims\n", height-4,width-2,y+1,x+1); + exit(1); + } keypad(text, TRUE); draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); diff --git a/gnu/lib/libdialog/yesno.c b/gnu/lib/libdialog/yesno.c index c97d80062931..3f21b5a7d585 100644 --- a/gnu/lib/libdialog/yesno.c +++ b/gnu/lib/libdialog/yesno.c @@ -40,6 +40,11 @@ int dialog_yesno(unsigned char *title, unsigned char * prompt, int height, int w draw_shadow(stdscr, y, x, height, width); #endif dialog = newwin(height, width, y, x); + if (dialog == NULL) { + endwin(); + fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); + exit(1); + } keypad(dialog, TRUE); draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);