summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--src/main.cpp12
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 <tmw@crushnet.org>
+2007-03-27 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/main.cpp: Icon loading doesn't necessarily succeed, so better
+ not crash when it doesn't.
+
+2007-03-20 Philipp Sehmisch <tmw@crushnet.org>
* 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