input/Plugin: copy protocols() to stack before using it

Fixes regression by commit 015cbff93d causing a crash bug because the
iterators of two different temporaries were used.
This commit is contained in:
Max Kellermann 2020-04-08 23:36:49 +02:00
parent db93bb996c
commit 9f8dc31b50
1 changed files with 2 additions and 1 deletions

View File

@ -33,7 +33,8 @@ InputPlugin::SupportsUri(const char *uri) const noexcept
if (StringStartsWithIgnoreCase(uri, *i))
return true;
} else {
return std::any_of(protocols().begin(), protocols().end(), [uri](const auto &schema)
const auto p = protocols();
return std::any_of(p.begin(), p.end(), [uri](const auto &schema)
{ return StringStartsWithIgnoreCase(uri, schema.c_str()); } );
}
return false;