Fixed entering offline mode

This commit is contained in:
Kai S. K. Engelbart 2020-02-12 22:22:29 +01:00
parent b3101e2418
commit 84fd222956
2 changed files with 2 additions and 6 deletions

View File

@ -101,8 +101,7 @@ public class LoginDialog extends JDialog {
// Listen to handshake rejections
EventBus.getInstance().register(HandshakeRejectionEvent.class, evt -> {
for (Component c : contentPanel.getComponents())
if (c == errorMessage) contentPanel.remove(errorMessage);
if (errorMessage != null) contentPanel.remove(errorMessage);
clearPasswordFields();
errorMessage = new JLabel(evt.get());
gbc_errorMessage = new GridBagConstraints();
@ -135,9 +134,7 @@ public class LoginDialog extends JDialog {
client.initReceiver(localDb, receivedMessageCache);
dispose();
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
} catch (TimeLimitExceededException e) {
} catch (IOException | InterruptedException | TimeLimitExceededException e) {
logger.warning("Could not connect to server. Trying offline mode...");
e.printStackTrace();
try {

View File

@ -101,7 +101,6 @@ public class Startup {
// Set client user in local database
localDb.setUser(client.getSender());
// Initialize chats in local database
try {
localDb.initializeUserStorage();