diff options
-rw-r--r-- | src/resources/colordb.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp index d9c76f18..46acaf39 100644 --- a/src/resources/colordb.cpp +++ b/src/resources/colordb.cpp @@ -55,7 +55,10 @@ void ColorDB::load() logger->log("Trying TMW's color file, %s.", TMW_COLOR_FILE); TMWHair = true; - delete doc; + + if (doc) + delete doc; + doc = new XML::Document(TMW_COLOR_FILE); root = doc->rootNode(); if (!root || !xmlStrEqual(root->name, BAD_CAST "colors")) @@ -63,6 +66,10 @@ void ColorDB::load() logger->log("ColorDB: Failed"); mColors[0] = mFail; mLoaded = true; + + if (doc) + delete doc; + return; } } @@ -84,7 +91,9 @@ void ColorDB::load() } } - delete doc; + if (doc) + delete doc; + mLoaded = true; } |