Fixed a crazy old bug in SettingsLayout when trying to add/remove an empty

directory in the settings screen.
This commit is contained in:
Casey Langen 2017-01-22 21:46:06 -08:00
parent 07bc12d283
commit a44c7c76a3

View File

@ -356,18 +356,24 @@ void SettingsLayout::LoadPreferences() {
void SettingsLayout::AddSelectedDirectory() {
size_t index = this->browseList->GetSelectedIndex();
std::string path = this->browseAdapter->GetFullPathAt(index);
if (path.size()) {
this->indexer->AddPath(path);
if (index != (size_t) -1) {
std::string path = this->browseAdapter->GetFullPathAt(index);
if (path.size()) {
this->indexer->AddPath(path);
}
}
}
void SettingsLayout::RemoveSelectedDirectory() {
std::vector<std::string> paths;
this->indexer->GetPaths(paths);
size_t index = this->addedPathsList->GetSelectedIndex();
this->indexer->RemovePath(paths.at(index));
if (index > (size_t) -1) {
this->indexer->RemovePath(paths.at(index));
}
}
void SettingsLayout::DrillIntoSelectedDirectory() {