Fix bug where Gecko codes would be "enabled by default"

Actually caused by IniFiles::GetLines leaving the output vector in its
old state if the section wasn't found, and Gecko::LoadCodes not checking
the return value.  Fix by moving lines->clear() up.
This commit is contained in:
comex 2015-06-02 19:04:04 -04:00
parent a3b3f0522b
commit 35ca27f1cd
1 changed files with 2 additions and 1 deletions

View File

@ -262,11 +262,12 @@ bool IniFile::GetKeys(const std::string& sectionName, std::vector<std::string>*
// Return a list of all lines in a section // Return a list of all lines in a section
bool IniFile::GetLines(const std::string& sectionName, std::vector<std::string>* lines, const bool remove_comments) const bool IniFile::GetLines(const std::string& sectionName, std::vector<std::string>* lines, const bool remove_comments) const
{ {
lines->clear();
const Section* section = GetSection(sectionName); const Section* section = GetSection(sectionName);
if (!section) if (!section)
return false; return false;
lines->clear();
for (std::string line : section->lines) for (std::string line : section->lines)
{ {
line = StripSpaces(line); line = StripSpaces(line);