summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-04-20 18:03:08 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-04-20 18:03:08 +0000
commitff6ddee79b67f756477f08cd7793b0e26bbe71d9 (patch)
treedf728e8b283dad5a8e71fdf6a419c9b61daac7d8
parent1d30fc204176ff23a4a55e0319246ab530ae6454 (diff)
downloadmana-ff6ddee79b67f756477f08cd7793b0e26bbe71d9.tar.gz
mana-ff6ddee79b67f756477f08cd7793b0e26bbe71d9.tar.bz2
mana-ff6ddee79b67f756477f08cd7793b0e26bbe71d9.tar.xz
mana-ff6ddee79b67f756477f08cd7793b0e26bbe71d9.zip
Since the connection objects might not have been created yet when an exception
is thrown, check them for 0 before calling disconnect on them.
-rw-r--r--ChangeLog3
-rw-r--r--src/main.cpp9
-rw-r--r--src/net/network.h3
3 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b0ca058f..202eec74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@
installing of dejavusans.ttf font.
* src/gui/chat.h, src/gui/chat.cpp: Merged two maps into one, avoid
non-const operator[] and check whether channel was found.
+ * src/main.cpp, src/net/network.h: Since the connection objects might
+ not have been created yet when an exception is thrown, check them for
+ 0 before calling disconnect on them.
2008-04-19 Yohann Ferreira <bertram@cegetel.net>
diff --git a/src/main.cpp b/src/main.cpp
index 4aadbb74..9ac4b9a3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1120,9 +1120,12 @@ int main(int argc, char *argv[])
logger->log("Exception");
}
- accountServerConnection->disconnect();
- gameServerConnection->disconnect();
- chatServerConnection->disconnect();
+ if (accountServerConnection)
+ accountServerConnection->disconnect();
+ if (gameServerConnection)
+ gameServerConnection->disconnect();
+ if (chatServerConnection)
+ chatServerConnection->disconnect();
delete accountServerConnection;
delete gameServerConnection;
diff --git a/src/net/network.h b/src/net/network.h
index 0701a956..42590adf 100644
--- a/src/net/network.h
+++ b/src/net/network.h
@@ -50,6 +50,9 @@ namespace Net
*/
void finalize();
+ /**
+ * Returns a new Connection object. Should be deleted by the caller.
+ */
Connection *getConnection();
/**