From 75ecd3b04df947ba1ac489f60933f18686b62ec1 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 27 Mar 2007 11:23:16 +0000 Subject: Icon loading doesn't necessarily succeed, so better not crash when it doesn't. --- ChangeLog | 7 ++++++- src/main.cpp | 12 +++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e12dda35..cc0341d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -2007-03-20 Philipp Sehmisch +2007-03-27 Bjørn Lindeijer + + * src/main.cpp: Icon loading doesn't necessarily succeed, so better + not crash when it doesn't. + +2007-03-20 Philipp Sehmisch * src/gui/updatewindow.cpp: Cancel button is now disabled after downloading is finished. diff --git a/src/main.cpp b/src/main.cpp index 11600b6f..71963786 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -255,11 +255,17 @@ void init_engine(const Options &options) static SDL_SysWMinfo pInfo; SDL_GetWMInfo(&pInfo); HICON icon = LoadIcon(GetModuleHandle(NULL), "A"); - SetClassLong(pInfo.window, GCL_HICON, (LONG) icon); + if (icon) + { + SetClassLong(pInfo.window, GCL_HICON, (LONG) icon); + } #else SDL_Surface *icon = IMG_Load(TMW_DATADIR "data/icons/tmw.png"); - SDL_SetAlpha(icon, SDL_SRCALPHA, SDL_ALPHA_OPAQUE); - SDL_WM_SetIcon(icon, NULL); + if (icon) + { + SDL_SetAlpha(icon, SDL_SRCALPHA, SDL_ALPHA_OPAQUE); + SDL_WM_SetIcon(icon, NULL); + } #endif #ifdef USE_OPENGL -- cgit v1.2.3-70-g09d2