aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNayd <dnpd.dd@gmail.com>2014-11-16 01:20:12 +0000
committerNayd <dnpd.dd@gmail.com>2014-11-16 01:20:12 +0000
commitb94e1cdc1d9e961946faff65d0bf1a399c416097 (patch)
tree8b4c5d42f96802e69141f25f10b0013cd816691c
parentd87504dee5cf3bd13fd8bb30d2937390cf7dfc1b (diff)
Core/Loading: Fix crash in LoadMissingKeyChains
Also emptied `world`.`keychain_db2` Closes #13566
-rw-r--r--sql/updates/world/2014_11_16_00_world.sql1
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp6
2 files changed, 7 insertions, 0 deletions
diff --git a/sql/updates/world/2014_11_16_00_world.sql b/sql/updates/world/2014_11_16_00_world.sql
new file mode 100644
index 00000000000..f2483d6aed5
--- /dev/null
+++ b/sql/updates/world/2014_11_16_00_world.sql
@@ -0,0 +1 @@
+TRUNCATE `keychain_db2`;
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 755b6a2ac59..90a40aa7990 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -9014,6 +9014,12 @@ void ObjectMgr::LoadMissingKeyChains()
uint32 id = fields[0].GetUInt32();
KeyChainEntry* kce = sKeyChainStore.CreateEntry(id, true);
+ if (!kce)
+ {
+ TC_LOG_ERROR("sql.sql", "Could not create KeyChainEntry %u, skipped.", id);
+ continue;
+ }
+
kce->Id = id;
for (uint32 i = 0; i < KEYCHAIN_SIZE; ++i)
kce->Key[i] = fields[1 + i].GetUInt8();