Skip to content

Commit

Permalink
Update libmimeapps, fixes OtterBrowser#1030
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocimier committed Dec 31, 2015
1 parent 3fb3bce commit bf53daf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
25 changes: 22 additions & 3 deletions 3rdparty/libmimeapps/Index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,22 @@ void Index::removeFromType(const std::string &type, const std::string &entryId)
{
if (*it == type)
{
types.erase(it);
if (it == types.begin())
{
types.erase(it);

it = types.begin();
}
else
{
std::vector<std::string>::iterator temp = it;
--temp;

types.erase(it);

it = ++temp;
}

}
else
{
Expand All @@ -271,13 +286,17 @@ void Index::removeUnused()
{
std::map<std::string, DesktopEntry*>::iterator application;

for (application = knownApplications_.begin(); application != knownApplications_.end(); ++application)
for (application = knownApplications_.begin(); application != knownApplications_.end();)
{
if (application->second->types().empty())
{
delete application->second;

knownApplications_.erase(application);
knownApplications_.erase(application++);
}
else
{
++application;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/libmimeapps/Tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ std::vector<std::string> split(const std::string &str, char delim)

bool match(std::string const& text, std::string const& pattern)
{
return std::search(text.begin(), text.end(), pattern.begin(), pattern.end() ) != text.end();
return std::search(text.begin(), text.end(), pattern.begin(), pattern.end()) != text.end();
}

std::vector<file> directoryEntries(const std::string &directory)
Expand Down

0 comments on commit bf53daf

Please sign in to comment.