From 2449f209b16216fafe0306c7c04ec19e2e2807f1 Mon Sep 17 00:00:00 2001 From: Stefan <2252537-stefan_test@users.noreply.gitlab.com> Date: Mon, 2 Jan 2023 20:20:01 +0000 Subject: [PATCH] python version check: fix error message edge case --- scripting/python_scripting.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/scripting/python_scripting.cpp b/scripting/python_scripting.cpp index c7152ccedc..79e26c6c42 100644 --- a/scripting/python_scripting.cpp +++ b/scripting/python_scripting.cpp @@ -115,18 +115,20 @@ except: "Python plugins will not be available." ) ); available = false; } - - version = version.Mid( idx + 10 ); - wxVersionInfo wxVI = wxGetLibraryVersionInfo(); - wxString wxVersion = wxString::Format( wxT( "%d.%d.%d" ), - wxVI.GetMajor(), wxVI.GetMinor(), wxVI.GetMicro() ); - - if( wxVersion.Cmp( version ) != 0 ) + else { - wxString msg = wxT( "The wxPython library was compiled against wxWidgets %s but KiCad is " - "using %s. Python plugins will not be available." ); - wxLogError( wxString::Format( msg, version, wxVersion ) ); - available = false; + wxVersionInfo wxVI = wxGetLibraryVersionInfo(); + wxString wxVersion = wxString::Format( wxT( "%d.%d.%d" ), + wxVI.GetMajor(), wxVI.GetMinor(), wxVI.GetMicro() ); + version = version.Mid( idx + 10 ); + + if( wxVersion.Cmp( version ) != 0 ) + { + wxString msg = wxT( "The wxPython library was compiled against wxWidgets %s but KiCad is " + "using %s. Python plugins will not be available." ); + wxLogError( wxString::Format( msg, version, wxVersion ) ); + available = false; + } } run = true;