summaryrefslogtreecommitdiff
path: root/src/utils/xml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/xml.cpp')
-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