Don't die when main icon cannot be loaded
authorChristoph Sommer <mail@christoph-sommer.de>
Mon, 23 Jun 2008 18:44:09 +0000 (18:44 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Mon, 23 Jun 2008 18:44:09 +0000 (18:44 +0000)
SVN-Revision: 5620

src/main.cpp

index 6acd08c..ed1317e 100644 (file)
@@ -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