summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-03-27 11:23:16 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-03-27 11:23:16 +0000
commit75ecd3b04df947ba1ac489f60933f18686b62ec1 (patch)
tree35651e318ca361a35606ac98ab7dae37965b6887
parent0b5aa685bf50d03f63126fb261cde464a2bc28e4 (diff)
downloadmana-75ecd3b04df947ba1ac489f60933f18686b62ec1.tar.gz
mana-75ecd3b04df947ba1ac489f60933f18686b62ec1.tar.bz2
mana-75ecd3b04df947ba1ac489f60933f18686b62ec1.tar.xz
mana-75ecd3b04df947ba1ac489f60933f18686b62ec1.zip
Icon loading doesn't necessarily succeed, so better not crash when it doesn't.
-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