-
Notifications
You must be signed in to change notification settings - Fork 772
Fix map-crash when floating npc use *npcspeed script command #2430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix map-crash when floating npc use *npcspeed script command #2430
Conversation
AnnieRuru
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are similar lines in *npcwalkto and *npcstop
however when I test it, it doesn't crash server
so I guess its OK ... I guess ?
|
@AnnieRuru this code may not crash server but corrupt memory probably better fix it in all functions |
|
at least it doesn't cause memory leak ... |
|
the reason it doesn't crash are probably due to : |
|
how about just adding if (nd->ud == NULL) {
ShowWarning("buildin_npcwalkto: floating NPC don't have unit data.\n");
return false;
}instead of let the script command fail silently ? |
- script command `npcspeed`, `npcwalkto`, `npcstop`, `unitwalk`, `unitwarp`, `unitstop` are not applicable for floating npc (without coordinate/location). - Fix map-crash due to unit_data `NULL`.
563485a to
1259ea8
Compare
|
Emistry, can you separate syntax fixing from the crash fixing? it's sort of impossible to review as it is right now. |
|
huh? like how? reset then redo to create 2 different commits? |
Pull Request Prelude
Changes Proposed
Check for unit data
(nd->ud != NULL)before adjust the NPC speed.Throw warnings if
nd->ud == NULL.Issues addressed:
script command
npcspeed,npcwalkto,npcstop,unitwalk,unitwarp,unitstopare not applicable for floating npc (without coordinate/location).Fix map-crash due to unit_data
NULL.Sample NPC Script:
Result:

After fixed: throw warnings but didnt crash map-server

Related PR #1733