Codechange: Remove create parameter from IniLoadFile::GetGroup.
GetGroup now only returns nullptr if the group does not exist. Use GetOrCreateGroup to create a group. This avoids creating groups while reading ini files.
This commit is contained in:

committed by
Peter Nelson

parent
c47a0e1578
commit
1fecbeff76
@@ -133,7 +133,7 @@ bool MusicSet::FillSetDetails(IniFile &ini, const std::string &path, const std::
|
||||
|
||||
this->songinfo[i].filename = filename; // non-owned pointer
|
||||
|
||||
IniItem *item = catindex->GetItem(_music_file_names[i]);
|
||||
IniItem *item = catindex != nullptr ? catindex->GetItem(_music_file_names[i]) : nullptr;
|
||||
if (item != nullptr && item->value.has_value() && !item->value->empty()) {
|
||||
/* Song has a CAT file index, assume it's MPS MIDI format */
|
||||
this->songinfo[i].filetype = MTT_MPSMIDI;
|
||||
@@ -158,7 +158,7 @@ bool MusicSet::FillSetDetails(IniFile &ini, const std::string &path, const std::
|
||||
* the beginning, so we don't start reading e.g. root. */
|
||||
while (*trimmed_filename == PATHSEPCHAR) trimmed_filename++;
|
||||
|
||||
item = names->GetItem(trimmed_filename);
|
||||
item = names != nullptr ? names->GetItem(trimmed_filename) : nullptr;
|
||||
if (item != nullptr && item->value.has_value() && !item->value->empty()) break;
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ bool MusicSet::FillSetDetails(IniFile &ini, const std::string &path, const std::
|
||||
this->songinfo[i].tracknr = tracknr++;
|
||||
}
|
||||
|
||||
item = trimmed_filename != nullptr ? timingtrim->GetItem(trimmed_filename) : nullptr;
|
||||
item = trimmed_filename != nullptr && timingtrim != nullptr ? timingtrim->GetItem(trimmed_filename) : nullptr;
|
||||
if (item != nullptr && item->value.has_value() && !item->value->empty()) {
|
||||
auto endpos = item->value->find(':');
|
||||
if (endpos != std::string::npos) {
|
||||
|
Reference in New Issue
Block a user