*
* The MIT License (MIT)
*
- * Copyright (C) 2016 Kevin Lamonte
+ * Copyright (C) 2017 Kevin Lamonte
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
// Draw each window in reverse Z order
List<TWindow> sorted = new LinkedList<TWindow>(windows);
Collections.sort(sorted);
- TWindow topLevel = sorted.get(0);
+ TWindow topLevel = null;
+ if (sorted.size() > 0) {
+ topLevel = sorted.get(0);
+ }
Collections.reverse(sorted);
for (TWindow window: sorted) {
window.drawChildren();
}
// Draw the status bar of the top-level window
- TStatusBar statusBar = topLevel.getStatusBar();
+ TStatusBar statusBar = null;
+ if (topLevel != null) {
+ statusBar = topLevel.getStatusBar();
+ }
if (statusBar != null) {
getScreen().resetClipping();
statusBar.setWidth(getScreen().getWidth());