mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2025-01-11 19:39:09 +01:00
-fixed codedump if no separator in string found
This commit is contained in:
parent
5457c30a83
commit
4dc425d650
@ -333,17 +333,18 @@ string Config::getString(const string &domain, const string &key, const string &
|
|||||||
vector<string> Config::getStrings(const string &domain, const string &key, char seperator, const string &defVal)
|
vector<string> Config::getStrings(const string &domain, const string &key, char seperator, const string &defVal)
|
||||||
{
|
{
|
||||||
vector<string> retval;
|
vector<string> retval;
|
||||||
|
|
||||||
if (domain.empty() || key.empty())
|
if(domain.empty() || key.empty())
|
||||||
{
|
{
|
||||||
if (defVal != std::string())
|
if(defVal != std::string())
|
||||||
retval.push_back(defVal);
|
retval.push_back(defVal);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
string &data = m_domains[upperCase(domain)][lowerCase(key)];
|
string &data = m_domains[upperCase(domain)][lowerCase(key)];
|
||||||
if (data.empty())
|
if(data.empty())
|
||||||
{
|
{
|
||||||
if (defVal != std::string())
|
if(defVal != std::string())
|
||||||
retval.push_back(defVal);
|
retval.push_back(defVal);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -355,7 +356,14 @@ vector<string> Config::getStrings(const string &domain, const string &key, char
|
|||||||
// find first "non-delimiter".
|
// find first "non-delimiter".
|
||||||
string::size_type pos = data.find_first_of(seperator, lastPos);
|
string::size_type pos = data.find_first_of(seperator, lastPos);
|
||||||
|
|
||||||
while (string::npos != pos || string::npos != lastPos)
|
// no seperator found, return data
|
||||||
|
if(pos == string::npos)
|
||||||
|
{
|
||||||
|
retval.push_back(data);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(string::npos != pos || string::npos != lastPos)
|
||||||
{
|
{
|
||||||
// found a token, add it to the vector.
|
// found a token, add it to the vector.
|
||||||
retval.push_back(data.substr(lastPos, pos - lastPos));
|
retval.push_back(data.substr(lastPos, pos - lastPos));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user