From: Christoph Sommer Date: Mon, 23 Jun 2008 18:44:09 +0000 (+0000) Subject: Don't die when main icon cannot be loaded X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=91b33d11d2555eb2672b9a9882a224c19e2fcb98;p=supertux.git Don't die when main icon cannot be loaded SVN-Revision: 5620 --- 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