From 91b33d11d2555eb2672b9a9882a224c19e2fcb98 Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Mon, 23 Jun 2008 18:44:09 +0000 Subject: [PATCH] Don't die when main icon cannot be loaded SVN-Revision: 5620 --- src/main.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6acd08c5e..ed1317e76 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -422,14 +422,20 @@ void init_video() #else const char* icon_fname = "images/engine/icons/supertux.xpm"; #endif - SDL_Surface* icon = IMG_Load_RW(get_physfs_SDLRWops(icon_fname), true); + SDL_Surface* icon; + try { + icon = IMG_Load_RW(get_physfs_SDLRWops(icon_fname), true); + } catch (const std::runtime_error& err) { + icon = 0; + log_warning << "Couldn't load icon '" << icon_fname << "': " << err.what() << std::endl; + } if(icon != 0) { SDL_WM_SetIcon(icon, 0); SDL_FreeSurface(icon); } #ifdef DEBUG else { - log_warning << "Couldn't find icon '" << icon_fname << "'" << std::endl; + log_warning << "Couldn't load icon '" << icon_fname << "'" << std::endl; } #endif -- 2.11.0