Issue information

Issue ID
#33
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Sep 10, 2007 14:38
Last Post
Hercules Elf Bot
Sep 10, 2007 14:38
Confirmation
N/A

Hercules Elf Bot - Sep 10, 2007 14:38

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

Inside BUILDIN_FUNC(getcharid) in script.c, the following piece of code is unreachable:
CODE
    default:
        ShowError("buildin_getcharid: invalid .\n");
        script_pushconststr(st,"");
        break;
    }

Because of this preceding part:
CODE
    if(sd==NULL || num<0 || num>3){
        script_pushint(st,0);    //return 0, according docs
        return 0;
    }


Also, if the new code (the unreachable code) is chosen to be permanent, and the other check is removed, then the returned value needs to be an integer and not a string. The reason for this, in any other case, and in the old error catch method, getcharid expects an integer value as return in a script. So, script_pushconststr(st,""); should be replaced by script_pushint(st,0);

Trancid