mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
Fixed crashes with not initialized CustomData
This commit is contained in:
@@ -28,6 +28,9 @@ public:
|
||||
*/
|
||||
template<class T> T* Get(std::string const & k) const {
|
||||
static_assert(std::is_base_of<Base, T>::value, "T must derive from Base");
|
||||
if (Container.empty())
|
||||
return nullptr;
|
||||
|
||||
auto it = Container.find(k);
|
||||
if (it != Container.end())
|
||||
return dynamic_cast<T*>(it->second.get());
|
||||
|
||||
@@ -71,6 +71,8 @@ Object::Object() : m_PackGUID(sizeof(uint64)+1)
|
||||
m_inWorld = false;
|
||||
m_objectUpdated = false;
|
||||
|
||||
CustomData.Set("base",new DataMap::Base); // avoid crash when access not initialized CustomData
|
||||
|
||||
m_PackGUID.appendPackGUID(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user