From c5cdff6213ed8d51b5861fe25ee60eefa82bdee7 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Mon, 4 Dec 2023 12:22:16 -0500 Subject: [PATCH] Fix crash launching editors with additional command line arguments --- common/gestfich.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/gestfich.cpp b/common/gestfich.cpp index a9c5f57c1a..68157cfdae 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -191,22 +191,22 @@ int ExecuteFile( const wxString& aEditorName, const wxString& aFileName, wxProce if( wxFileExists( fullEditorName ) ) { int i = 0; - const wchar_t* args[4]; + std::vector args; - args[i++] = fullEditorName.wc_str(); + args.emplace_back( fullEditorName.wc_str() ); if( !params.empty() ) { for( const wxString& p : params ) - args[i++] = p.wc_str(); + args.emplace_back( p.wc_str() ); } if( !aFileName.IsEmpty() ) - args[i++] = aFileName.wc_str(); + args.emplace_back( aFileName.wc_str() ); - args[i] = nullptr; + args.emplace_back( nullptr ); - return wxExecute( const_cast( args ), wxEXEC_ASYNC, aCallback ); + return wxExecute( const_cast( args.data() ), wxEXEC_ASYNC, aCallback ); } wxString msg;