summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/windows/logindialog.cpp14
-rw-r--r--src/utils/xml.cpp15
2 files changed, 21 insertions, 8 deletions
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index 47e86471e..93bf10bc3 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -94,7 +94,8 @@ LoginDialog::LoginDialog(LoginData &data,
setCloseButton(true);
setWindowName("Login");
- charServerHandler->clear();
+ if (charServerHandler)
+ charServerHandler->clear();
// TRANSLATORS: login dialog label
Label *const serverLabel1 = new Label(this, _("Server:"));
@@ -191,8 +192,15 @@ void LoginDialog::postInit()
mPassField->requestFocus();
mLoginButton->setEnabled(canSubmit());
- mRegisterButton->setEnabled(loginHandler->isRegistrationEnabled()
- || !mLoginData->registerUrl.empty());
+ if (loginHandler)
+ {
+ mRegisterButton->setEnabled(loginHandler->isRegistrationEnabled()
+ || !mLoginData->registerUrl.empty());
+ }
+ else
+ {
+ mRegisterButton->setEnabled(false);
+ }
}
LoginDialog::~LoginDialog()
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index cb0cc56b8..8642140c9 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -104,11 +104,16 @@ namespace XML
// Get length of file
file.seekg(0, std::ios::end);
size = static_cast<int>(file.tellg());
- file.seekg(0, std::ios::beg);
-
- data = static_cast<char*>(malloc(size));
-
- file.read(data, size);
+ if (size < 0)
+ {
+ logger->log("Error loading XML file %s", filename.c_str());
+ }
+ else
+ {
+ file.seekg(0, std::ios::beg);
+ data = static_cast<char*>(malloc(size));
+ file.read(data, size);
+ }
file.close();
}
else