diff --git a/src/musikbox/app/layout/SettingsLayout.cpp b/src/musikbox/app/layout/SettingsLayout.cpp index 33be2770b..864843576 100755 --- a/src/musikbox/app/layout/SettingsLayout.cpp +++ b/src/musikbox/app/layout/SettingsLayout.cpp @@ -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 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() {