X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTWidget.java;h=bca2be02f21f03cc305985a56fbf82c5314ae75c;hb=c7a75ad30c309a84077cc29baace48a001af0fec;hp=bcf798ae36e9f40336d40fcd18d11e3a58b0de6c;hpb=5ffeabccc177e9fdadb62002c6d3bf1f6ae650fa;p=fanfix.git diff --git a/src/jexer/TWidget.java b/src/jexer/TWidget.java index bcf798a..bca2be0 100644 --- a/src/jexer/TWidget.java +++ b/src/jexer/TWidget.java @@ -619,6 +619,9 @@ public abstract class TWidget implements Comparable { List widgets = null; switch (menu.getId()) { case TMenu.MID_SPLIT_VERTICAL: + if (children.size() == 0) { + break; + } panel = new TPanel(null, x, y, width, height); pane = new TSplitPane(null, x, y, width, height, true); widgets = new ArrayList(children); @@ -641,6 +644,9 @@ public abstract class TWidget implements Comparable { assert (panel.isActive() == true); return; case TMenu.MID_SPLIT_HORIZONTAL: + if (children.size() == 0) { + break; + } panel = new TPanel(null, x, y, width, height); pane = new TSplitPane(null, x, y, width, height, false); widgets = new ArrayList(children); @@ -1161,19 +1167,25 @@ public abstract class TWidget implements Comparable { /** * Get this TWidget's parent TApplication. * - * @return the parent TApplication + * @return the parent TApplication, or null if not assigned */ public TApplication getApplication() { - return window.getApplication(); + if (window != null) { + return window.getApplication(); + } + return null; } /** * Get the Screen. * - * @return the Screen + * @return the Screen, or null if not assigned */ public Screen getScreen() { - return window.getScreen(); + if (window != null) { + return window.getScreen(); + } + return null; } /**