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. --- src/main.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/main.cpp') 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-60-g2f50