summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-07-17 13:55:59 +0300
committerAndrei Karas <akaras@inbox.ru>2015-07-17 13:55:59 +0300
commit89dd7d47dabcc52a56a89d9ac5246582fa1b138c (patch)
treec795eb2a2c218029de17e0ca40ea8b6d00dc3c81 /src/utils
parent420c7c31f6ac97741feaf9f34e641ec0d6e0fdf5 (diff)
downloadmanaplus-89dd7d47dabcc52a56a89d9ac5246582fa1b138c.tar.gz
manaplus-89dd7d47dabcc52a56a89d9ac5246582fa1b138c.tar.bz2
manaplus-89dd7d47dabcc52a56a89d9ac5246582fa1b138c.tar.xz
manaplus-89dd7d47dabcc52a56a89d9ac5246582fa1b138c.zip
Add missing checks into logindialog and xml.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/xml.cpp15
1 files changed, 10 insertions, 5 deletions
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