From 79fd1d5babc77c233c23e5c9ea7f50bce0f67493 Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Sun, 15 Jun 2014 12:53:13 +0300 Subject: [PATCH] Eluna fix crash on reload eluna used from console --- HookMgr.cpp | 3 ++- HookMgr.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/HookMgr.cpp b/HookMgr.cpp index 08c210c..6c14ac8 100644 --- a/HookMgr.cpp +++ b/HookMgr.cpp @@ -463,8 +463,9 @@ bool Eluna::OnRemove(Player* pPlayer, Item* item) // Player bool Eluna::OnCommand(Player* player, const char* text) { + // If from console, player is NULL std::string fullcmd(text); - if (player->GetSession()->GetSecurity() >= SEC_ADMINISTRATOR) + if (!player || player->GetSession()->GetSecurity() >= SEC_ADMINISTRATOR) { char* creload = strtok((char*)text, " "); char* celuna = strtok(NULL, ""); diff --git a/HookMgr.h b/HookMgr.h index 9eeaae7..de91deb 100644 --- a/HookMgr.h +++ b/HookMgr.h @@ -135,7 +135,7 @@ namespace HookMgr // UNUSED = 39, // (event, player) // UNUSED = 40, // (event, player) // UNUSED = 41, // (event, player) - PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command) - Can return false + PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command) - player is nil if command used from console. Can return false PLAYER_EVENT_COUNT };