Fixed nullPointerException in main window