From 3a7a87a978e722836699cf55a79483030da20f29 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Wed, 27 May 2020 14:34:03 +0200
Subject: [PATCH] [A/DE/VtkVis] Using std::find_if instead of a raw loop.

---
 Applications/DataExplorer/VtkVis/VtkRaster.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/Applications/DataExplorer/VtkVis/VtkRaster.cpp b/Applications/DataExplorer/VtkVis/VtkRaster.cpp
index 7d0ae1125aa..91d6e4a817a 100644
--- a/Applications/DataExplorer/VtkVis/VtkRaster.cpp
+++ b/Applications/DataExplorer/VtkVis/VtkRaster.cpp
@@ -316,12 +316,14 @@ std::string VtkRaster::findWorldFile(std::string const& filename)
       ".bpw", ".bmpw", ".bpwx",
       ".wld" };
 
-    for (auto& ext : supported_extensions)
+    auto const res =
+        std::find_if(supported_extensions.begin(), supported_extensions.end(),
+                     [&no_ext](auto const& ext) -> bool {
+                         return BaseLib::IsFileExisting(no_ext + ext);
+                     });
+    if (res != supported_extensions.end())
     {
-        if (BaseLib::IsFileExisting(no_ext + ext))
-        {
-            return no_ext + ext;
-        }
+        return no_ext + *res;
     }
 
     // no world file found
-- 
GitLab