Issue information

Issue ID
#7721
Status
Fixed
Severity
None
Started
purityz
Sep 23, 2013 21:53
Last Post
Haru
Sep 24, 2013 14:07
Confirmation
N/A

purityz - Sep 23, 2013 21:53

run this
[code=auto:0] - script test -1,{ OnInit: $@team1= bg_create_team("prontera",36,39); $@team2 = bg_create_team("prontera",168,156); end; } [/code]


crash at start up
[quote]
int bg_send_xy_timer(int tid, unsigned int tick, int id, intptr_t data) {
[u][i][b]//[/b][/i][/u]bg->team_db->foreach(bg->team_db, bg->send_xy_timer_sub, tick); [b][i][u]<< comment this line out stop mapserver from crashing[/u][/i][/b]
return 0;
}[/quote]

This post has been edited by purityz on Sep 23, 2013 22:50

Dastgir Pojee - Sep 24, 2013 3:54

[quote]
int bg_send_xy_timer_sub(DBKey key, DBData *data, va_list ap)
{
struct battleground_data *bg = DB->data2ptr(data);
struct map_session_data *sd;
int i;
nullpo_ret(bg);
for( i = 0; i < MAX_BG_MEMBERS; i++ ) {
if( (sd = bg->members[i].sd) == NULL )
continue;
[b]if( sd->bl.x != bg->members[i].x || sd->bl.y != bg->members[i].y ) { // xy update[/b]
bg->members[i].x = sd->bl.x;
bg->members[i].y = sd->bl.y;
clif->bg_xy(sd);
}
}
return 0;
}[/quote]

Its seems that bg->members[i].sd is not null and it let the process go, but
[b]sd->bl.x , its empty, bcoz no one's attached, that causes the map to crash.[/b]

This post has been edited by Dastgir Pojee on Sep 24, 2013 4:14

purityz - Sep 24, 2013 10:42

so you can reproduce it too. sir?

Haru - Sep 24, 2013 11:06

Confirmed, since [url="https://github.com/HerculesWS/Hercules/commit/35c131c7ff945bff238e3e242e513b5fe42a0067"]https://github.com/HerculesWS/Hercules/commit/35c131c7ff945bff238e3e242e513b5fe42a0067[/url]

Some null-pointer checks (and possibly other assignments) are no longer in place, since they're still using 'bg', while they should use 'bgd' or whichever variable is applicable to the specific case.

Fix coming soon (but lunch comes first.)

Haru - Sep 24, 2013 14:07

Fixed in [url="https://github.com/HerculesWS/Hercules/commit/b9c8f57b92d2935db971a38e144529682712dc82"]https://github.com/HerculesWS/Hercules/commit/b9c8f57b92d2935db971a38e144529682712dc82[/url]