Don't crash when you select "Channel list" when you have no open sessions

This commit is contained in:
Tristan B. Kildaire 2021-01-27 22:37:20 +02:00
parent 62895ccaee
commit ce9a675da0
1 changed files with 13 additions and 0 deletions

View File

@ -462,6 +462,19 @@ public class GUI : Thread
box.add(new JoinButtonCustom(customChannelEntry));
channelsList.add(box);
/* If there are no available connections */
if(!connections.length)
{
import gtk.MessageDialog;
MessageDialog errorDialog = new MessageDialog(mainWindow, GtkDialogFlags.MODAL, GtkMessageType.ERROR, GtkButtonsType.CLOSE, false, "Cannot list channels\n\nYou are not connected to a server");
errorDialog.setIconName("user-available");
// errorDialog.set
errorDialog.run();
return;
}
/* Get the current connection */
Connection currentConnection = connections[notebook.getCurrentPage()];