Commit ca26d548 authored by nanahira's avatar nanahira

for invalid regex

parent 1ad5b7b9
...@@ -2082,18 +2082,30 @@ void Game::takeScreenshot() { ...@@ -2082,18 +2082,30 @@ void Game::takeScreenshot() {
bool Game::CheckRegEx(const wchar_t* text, const wchar_t* exp, bool exact) { bool Game::CheckRegEx(const wchar_t* text, const wchar_t* exp, bool exact) {
//if(std::wregex(exp) == NULL) //if(std::wregex(exp) == NULL)
// return false; // return false;
if(exact) bool result;
return !!std::regex_match(text, std::wregex(exp)); try {
else if(exact)
return !!std::regex_search(text, std::wregex(exp)); result = std::regex_match(text, std::wregex(exp));
else
result = std::regex_search(text, std::wregex(exp));
} catch(...) {
result = false;
}
return result;
} }
bool Game::CheckRegEx(std::wstring text, const wchar_t* exp, bool exact) { bool Game::CheckRegEx(std::wstring text, const wchar_t* exp, bool exact) {
//if(std::wregex(exp) == NULL) //if(std::wregex(exp) == NULL)
// return false; // return false;
if(exact) bool result;
return !!std::regex_match(text, std::wregex(exp)); try {
else if(exact)
return !!std::regex_search(text, std::wregex(exp)); result = std::regex_match(text, std::wregex(exp));
else
result = std::regex_search(text, std::wregex(exp));
} catch(...) {
result = false;
}
return result;
} }
const char* Game::GetLocaleDir(const char* dir) { const char* Game::GetLocaleDir(const char* dir) {
if(!gameConf.locale || !wcscmp(gameConf.locale, L"default")) if(!gameConf.locale || !wcscmp(gameConf.locale, L"default"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment