summaryrefslogtreecommitdiff
path: root/source3/utils/regedit_treeview.c
diff options
context:
space:
mode:
authorChris Davis <cd.rattan@gmail.com>2014-06-16 17:36:16 -0700
committerMichael Adam <obnox@samba.org>2014-10-01 14:32:08 +0200
commit55662513e14c026eb4cfa044ed772b31be5d6ab9 (patch)
tree2615f4b05deef0495a1f1d8260257d3a953149f7 /source3/utils/regedit_treeview.c
parentc85cc6b8360284c64d60ff4d09ca8d5e03188f7b (diff)
downloadsamba-55662513e14c026eb4cfa044ed772b31be5d6ab9.tar.gz
regedit: handle awkward window sizes better
This fixes some assertion failures and an infinte loop that occurs when the terminal window is shrunk down far enough to the point regedit can't fit everything on screen. Signed-off-by: Chris Davis <cd.rattan@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/utils/regedit_treeview.c')
-rw-r--r--source3/utils/regedit_treeview.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source3/utils/regedit_treeview.c b/source3/utils/regedit_treeview.c
index 47765c16de6..9962ad99fba 100644
--- a/source3/utils/regedit_treeview.c
+++ b/source3/utils/regedit_treeview.c
@@ -445,7 +445,14 @@ void tree_view_resize(struct tree_view *view, int nlines, int ncols,
WINDOW *nwin, *nsub;
nwin = newwin(nlines, ncols, begin_y, begin_x);
+ if (nwin == NULL) {
+ return;
+ }
nsub = subwin(nwin, nlines - 2, ncols - 2, begin_y + 1, begin_x + 1);
+ if (nsub == NULL) {
+ delwin(nwin);
+ return;
+ }
replace_panel(view->panel, nwin);
delwin(view->sub);
delwin(view->window);