aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2019-01-01 15:00:27 +0100
committerShauren <shauren.trinity@gmail.com>2021-11-18 15:57:20 +0100
commitff2cd4a0322fc2942323702a37844b0cfa963ce4 (patch)
tree2c044d92c7c68e8d53f99a34a52f33b49cced2ec /src
parentce794f3978e853341b2dc0c782e7bda34303b3f8 (diff)
Scripts/Commands: Fix crash caused by .set npc model (#22877)
* Scripts/Commands: Fix crash caused by .set npc model Fix crash caused by .set npc model with invalid model id (cherry picked from commit 20ea24bf5ccf165ce19139d1f7ec7c650719eb68)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Miscellaneous/Language.h2
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp2
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp7
3 files changed, 9 insertions, 2 deletions
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index 4db3b72c31d..1ee3866c201 100644
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -362,7 +362,7 @@ enum TrinityStrings
LANG_COMMAND_MODIFY_ARENA = 306,
LANG_COMMAND_FACTION_NOTFOUND = 307,
LANG_COMMAND_FACTION_UNKNOWN = 308,
- LANG_COMMAND_FACTION_INVPARAM = 309,
+ LANG_COMMAND_INVALID_PARAM = 309,
LANG_COMMAND_FACTION_DELTA = 310,
LANG_FACTION_LIST = 311,
LANG_FACTION_VISIBLE = 312,
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index a0eaa8aea32..804d6736455 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -734,7 +734,7 @@ public:
if (rankThresholdItr == end)
{
- handler->PSendSysMessage(LANG_COMMAND_FACTION_INVPARAM, rankTxt);
+ handler->PSendSysMessage(LANG_COMMAND_INVALID_PARAM, rankTxt);
handler->SetSentErrorMessage(true);
return false;
}
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index a2e77968346..0c82ee14b7f 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -879,6 +879,13 @@ public:
return false;
}
+ if (!sCreatureDisplayInfoStore.LookupEntry(displayId))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_INVALID_PARAM, args);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
creature->SetDisplayId(displayId);
creature->SetNativeDisplayId(displayId);