Issue information

Issue ID
#1236
Status
Working as Intended
Severity
None
Started
Hercules Elf Bot
Mar 21, 2008 12:08
Last Post
Hercules Elf Bot
Apr 4, 2012 9:57
Confirmation
Yes (1)
No (0)

Hercules Elf Bot - Mar 21, 2008 12:08

Originally posted by [b]Ai4rei[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=1236

Considering this piece of script:

CODE
payon,155,99,5    script    TestNPC    885,{
    atcommand "@unloadnpc TestNPC";
}
(Self unloading)

If you run the script, the map server crashes on (/src/map/script.c):
CODE
static int unget_com_data=-1;
int get_com(unsigned char *script,int *pos)
{
    int i,j;
    if(unget_com_data>=0){
        i=unget_com_data;
        unget_com_data=-1;
        return i;
    }
    if(script[*pos]>=0x80){  // <-- crashes
        return C_INT;
    }
    i=0; j=0;
    while(script[*pos]>=0x40){
        i=script[(*pos)++]<<j;
        j+=6;
    }
    return i+(script[(*pos)++]<<j);
}


I remember that worked a time ago, and even if is a weird script, it still shouldn't crash the server.

Hercules Elf Bot - Dec 14, 2011 23:52

Originally posted by [b]Ind[/b]
in my opinion it's working as intended -- you tell the damn thing to unload and it unloads, then it tries to end the session of a npc instance that no longer exists because you deleted. alternatively we could add a unloadnpc() script command that'd run a timer small enough to end the npc instance and then unload itself, but imo this is working as intended :P