From 27f12a4eb5d22d10fc77a7f2e53acf14a2411ce8 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 12 Sep 2026 20:48:08 +0200 Subject: [PATCH] Report unloadable trace files on the command line instead of crashing. Version and integrity checks throw from the View constructor, which was outside the try/catch guarding the file open, so a bad argv trace terminated the process. Catch and report it there as well. --- profiler/src/main.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index c2fa249a..547f7328 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -407,7 +407,16 @@ int main( int argc, char** argv ) EM_ASM( alert( UTF8ToString( $0 ) ), msg.c_str() ); } #else - view.store( std::make_shared( RunOnMainThread, *initFileOpen, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback, s_achievements ), std::memory_order_release ); + try + { + view.store( std::make_shared( RunOnMainThread, *initFileOpen, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback, s_achievements ), std::memory_order_release ); + } + catch( const std::exception& e ) + { + fprintf( stderr, "Cannot load trace file: %s\n", e.what() ); + initFileOpen.reset(); + _Exit( 1 ); + } #endif initFileOpen.reset(); }