mirror of
https://github.com/scorpion-26/gBar.git
synced 2024-11-21 18:52:49 +00:00
Don't crash for empty string config
Fixes https://github.com/scorpion-26/gBar/issues/49
This commit is contained in:
parent
0812c3680f
commit
b215dfb145
1 changed files with 8 additions and 1 deletions
|
@ -127,7 +127,14 @@ void AddConfigVar(const std::string& propertyName, T& propertyToSet, std::string
|
|||
std::string_view value = line.substr(colon + 1);
|
||||
size_t beginValue = value.find_first_not_of(whitespace);
|
||||
size_t endValue = value.find_last_not_of(whitespace);
|
||||
value = value.substr(beginValue, endValue - beginValue + 1);
|
||||
if (beginValue == std::string::npos || endValue == std::string::npos)
|
||||
{
|
||||
value = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
value = value.substr(beginValue, endValue - beginValue + 1);
|
||||
}
|
||||
|
||||
// Set value
|
||||
ApplyProperty(propertyToSet, value);
|
||||
|
|
Loading…
Reference in a new issue