-
Notifications
You must be signed in to change notification settings - Fork 772
Fix map-server crash when using npcspeed on a npc not on a map #1733
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
Conversation
src/map/script.c
Outdated
| unit->bl2ud2(&nd->bl); // ensure nd->ud is safe to edit | ||
| nd->speed = speed; | ||
| nd->ud->state.speed_changed = 1; | ||
| if (nd->ud != NULL) { // nd->ud is NULL when called on an NPC which is not on a map |
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.
Probably better show error message and not silently ignore it?
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.
resolved.
|
btw, how do I add the co-author back to the commit message? cant seem to find the author email. @chriser- is this right ? DetailsEDIT -- after i update the fork it became 2 commits, should I squash it together? does anything in the merge commit would break this PR?EDIT2-- |
src/map/script.c
Outdated
| struct npc_data* nd; | ||
| static BUILDIN(npcspeed) | ||
| { | ||
| struct npc_data *nd; |
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.
nd and speed vars better use in same line with defining.
For example for nd:
struct npc_data *nd = map->id2nd(st->oid);
|
also need rebase |
|
about coauthor, you can add anything into commit messages |
- fix map-server crash issue.
|
If it is easier, you can just re-do the fix in master and commit it under your own name. |
|
closing this due to the commits are actually done in |
|
anyone wants to remove this from Stalled / Forgotten in Project Board? |
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:
Prevent map-server from crashing when adjust the NPC speed.
Sample NPC Script:
Result:

After fixed: throw warnings but didnt crash map-server
