Fixed NPE error/freeze on broken server connection

This commit is contained in:
Oleg Agafonov 2019-01-25 10:41:50 +04:00
parent 7d07c94bc9
commit 481b5f04ea

View file

@ -626,16 +626,21 @@ public class TablesPanel extends javax.swing.JPanel {
// reload server messages
java.util.List<String> serverMessages = SessionHandler.getServerMessages();
synchronized (this) {
this.messages = serverMessages;
if (serverMessages != null) {
this.messages = serverMessages;
} else {
this.messages = new ArrayList<>();
}
this.currentMessage = 0;
}
if (serverMessages.isEmpty()) {
if (this.messages.isEmpty()) {
this.jPanelBottom.setVisible(false);
} else {
this.jPanelBottom.setVisible(true);
URLHandler.RemoveMouseAdapter(jLabelFooterText);
URLHandler.handleMessage(serverMessages.get(0), this.jLabelFooterText);
this.jButtonFooterNext.setVisible(serverMessages.size() > 1);
URLHandler.handleMessage(this.messages.get(0), this.jLabelFooterText);
this.jButtonFooterNext.setVisible(this.messages.size() > 1);
}
}