From 26beb30f77323299abd126faf1ca32127c1d0254 Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Thu, 18 May 2017 13:04:20 +0800 Subject: [PATCH] Fix bug in StringEngine --- MiniEngine.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/MiniEngine.cpp b/MiniEngine.cpp index 1f28b1a..0cffbb2 100644 --- a/MiniEngine.cpp +++ b/MiniEngine.cpp @@ -1967,6 +1967,7 @@ namespace MiniEngine { pimpl=new impl; pimpl->status=false; + std::ifstream ifs(StringFile); if(!ifs) return; rapidxml::file<> strFile(ifs); @@ -1999,9 +2000,11 @@ namespace MiniEngine std::string StringEngine::getString(std::string Tag) { - if(!ready()) return ""; - char* context=pimpl->root->first_node(Tag.c_str())->value(); - if(context==nullptr) return ""; + if(!ready()) return "(StringEngine::STRING_NOT_FOUND)"; + rapidxml::xml_node<>* pnode=pimpl->root->first_node(Tag.c_str()); + if(pnode==nullptr) return "(StringEngine::STRING_NOT_FOUND)"; + char* context=pnode->value(); + if(context==nullptr) return "";/// Empty String. else return std::string(context); }