Fix 9cdf740097: Don't make copy of format providers when making a screenshot. (#14681)

While here, use projection instead of lambda to select provider.
This commit is contained in:
Peter Nelson
2025-09-29 21:02:08 +01:00
committed by dP
parent 9dbdc00439
commit 4683148890

View File

@@ -48,10 +48,10 @@ uint _heightmap_highest_peak; ///< When saving a heightmap, this contain
*/
static ScreenshotProvider *GetScreenshotProvider()
{
auto providers = ProviderManager<ScreenshotProvider>::GetProviders();
const auto &providers = ProviderManager<ScreenshotProvider>::GetProviders();
if (providers.empty()) return nullptr;
auto it = std::ranges::find_if(providers, [](const auto &p) { return p->GetName() == _screenshot_format_name; });
auto it = std::ranges::find(providers, _screenshot_format_name, &ScreenshotProvider::GetName);
if (it != std::end(providers)) return *it;
return providers.front();