From 35ca27f1cddedf537dfe3f69f0a9ca422fa6b1e0 Mon Sep 17 00:00:00 2001 From: comex Date: Tue, 2 Jun 2015 19:04:04 -0400 Subject: [PATCH] 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. --- Source/Core/Common/IniFile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index 3d41ff659d..dda4f5e115 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -262,11 +262,12 @@ bool IniFile::GetKeys(const std::string& sectionName, std::vector* // Return a list of all lines in a section bool IniFile::GetLines(const std::string& sectionName, std::vector* lines, const bool remove_comments) const { + lines->clear(); + const Section* section = GetSection(sectionName); if (!section) return false; - lines->clear(); for (std::string line : section->lines) { line = StripSpaces(line);