Browse Source

* Fixed a crash when shutting down char-server (TXT only), after it failed to load storage save data (since r1275).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14483 54d463be-8e91-2dee-dedb-b68131a5f0ec
ai4rei 14 years ago
parent
commit
c56477a9fc
2 changed files with 11 additions and 4 deletions
  1. 1 0
      Changelog-Trunk.txt
  2. 10 4
      src/char/int_storage.c

+ 1 - 0
Changelog-Trunk.txt

@@ -2,6 +2,7 @@ Date	Added
 
 
 2010/11/22
 2010/11/22
 	* mail_deliveryfail no longer attempts to log (since r12910) and give items (since r11855), when there is no item attached to the mail (bugreport:3239). [Ai4rei]
 	* mail_deliveryfail no longer attempts to log (since r12910) and give items (since r11855), when there is no item attached to the mail (bugreport:3239). [Ai4rei]
+	* Fixed a crash when shutting down char-server (TXT only), after it failed to load storage save data (since r1275). [Ai4rei]
 2010/11/21
 2010/11/21
 	* Added msinttypes (rev. 26, http://msinttypes.googlecode.com/svn/trunk/) portability framework for Visual C++ compilers (related bugreport:4059). [Ai4rei]
 	* Added msinttypes (rev. 26, http://msinttypes.googlecode.com/svn/trunk/) portability framework for Visual C++ compilers (related bugreport:4059). [Ai4rei]
 	* Added 64-bit variants of the socket and buffer I/O macros. [Ai4rei]
 	* Added 64-bit variants of the socket and buffer I/O macros. [Ai4rei]

+ 10 - 4
src/char/int_storage.c

@@ -23,8 +23,8 @@
 char storage_txt[1024]="save/storage.txt";
 char storage_txt[1024]="save/storage.txt";
 char guild_storage_txt[1024]="save/g_storage.txt";
 char guild_storage_txt[1024]="save/g_storage.txt";
 
 
-static DBMap* storage_db; // int account_id -> struct storage_data*
-static DBMap* guild_storage_db; // int guild_id -> struct guild_storage*
+static DBMap* storage_db = NULL; // int account_id -> struct storage_data*
+static DBMap* guild_storage_db = NULL; // int guild_id -> struct guild_storage*
 
 
 // 倉庫データを文字列に変換
 // 倉庫データを文字列に変換
 bool storage_tostr(char* str, int account_id, struct storage_data* p)
 bool storage_tostr(char* str, int account_id, struct storage_data* p)
@@ -280,8 +280,14 @@ int inter_storage_init()
 }
 }
 
 
 void inter_storage_final() {
 void inter_storage_final() {
-	storage_db->destroy(storage_db, NULL);
-	guild_storage_db->destroy(guild_storage_db, NULL);
+	if(storage_db)
+	{
+		storage_db->destroy(storage_db, NULL);
+	}
+	if(guild_storage_db)
+	{
+		guild_storage_db->destroy(guild_storage_db, NULL);
+	}
 	return;
 	return;
 }
 }