From 89dd7d47dabcc52a56a89d9ac5246582fa1b138c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 17 Jul 2015 13:55:59 +0300 Subject: Add missing checks into logindialog and xml. --- src/utils/xml.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/utils') 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(file.tellg()); - file.seekg(0, std::ios::beg); - - data = static_cast(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(malloc(size)); + file.read(data, size); + } file.close(); } else -- cgit v1.2.3-70-g09d2