diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-07-17 13:55:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-07-17 13:55:59 +0300 |
commit | 89dd7d47dabcc52a56a89d9ac5246582fa1b138c (patch) | |
tree | c795eb2a2c218029de17e0ca40ea8b6d00dc3c81 /src/utils | |
parent | 420c7c31f6ac97741feaf9f34e641ec0d6e0fdf5 (diff) | |
download | plus-89dd7d47dabcc52a56a89d9ac5246582fa1b138c.tar.gz plus-89dd7d47dabcc52a56a89d9ac5246582fa1b138c.tar.bz2 plus-89dd7d47dabcc52a56a89d9ac5246582fa1b138c.tar.xz plus-89dd7d47dabcc52a56a89d9ac5246582fa1b138c.zip |
Add missing checks into logindialog and xml.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/xml.cpp | 15 |
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 |