Fix bug in StringEngine

This commit is contained in:
Kirigaya Kazuto 2017-05-18 13:04:20 +08:00
parent b6ecc0f856
commit 26beb30f77

View File

@ -1967,6 +1967,7 @@ namespace MiniEngine
{ {
pimpl=new impl; pimpl=new impl;
pimpl->status=false; pimpl->status=false;
std::ifstream ifs(StringFile); std::ifstream ifs(StringFile);
if(!ifs) return; if(!ifs) return;
rapidxml::file<> strFile(ifs); rapidxml::file<> strFile(ifs);
@ -1999,9 +2000,11 @@ namespace MiniEngine
std::string StringEngine::getString(std::string Tag) std::string StringEngine::getString(std::string Tag)
{ {
if(!ready()) return ""; if(!ready()) return "(StringEngine::STRING_NOT_FOUND)";
char* context=pimpl->root->first_node(Tag.c_str())->value(); rapidxml::xml_node<>* pnode=pimpl->root->first_node(Tag.c_str());
if(context==nullptr) return ""; if(pnode==nullptr) return "(StringEngine::STRING_NOT_FOUND)";
char* context=pnode->value();
if(context==nullptr) return "";/// Empty String.
else return std::string(context); else return std::string(context);
} }