From 5554bdf329d69ba7f7180fa6c2eb0cacd55697f3 Mon Sep 17 00:00:00 2001 From: scottr Date: Wed, 2 Jun 2021 08:46:57 -0700 Subject: [PATCH] [ftue_auto_register] use early return in registered engines loop instead of break --- Code/Tools/ProjectManager/Source/PythonBindings.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.cpp b/Code/Tools/ProjectManager/Source/PythonBindings.cpp index ca8e571de5..2859a8fc9d 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.cpp +++ b/Code/Tools/ProjectManager/Source/PythonBindings.cpp @@ -320,8 +320,6 @@ namespace O3DE::ProjectManager bool pythonResult = ExecuteWithLock( [&] { - bool registerThis = true; - // check current engine path against all other registered engines // to see if we are already registered auto allEngines = m_manifest.attr("get_engines")(); @@ -332,17 +330,13 @@ namespace O3DE::ProjectManager AZ::IO::FixedMaxPath enginePath(Py_To_String(engine["path"])); if (enginePath.Compare(m_enginePath) == 0) { - registerThis = false; - break; + return; } } } - if (registerThis) - { - auto result = m_register.attr("register")(m_enginePath.c_str()); - registrationResult = (result.cast() == 0); - } + auto result = m_register.attr("register")(m_enginePath.c_str()); + registrationResult = (result.cast() == 0); }); bool finalResult = (registrationResult && pythonResult);