Issue information

Issue ID
#8074
Status
Fixed
Severity
None
Started
ahmadshidqi
Mar 9, 2014 17:06
Last Post
ahmadshidqi
Mar 10, 2014 1:44
Confirmation
N/A

ahmadshidqi - Mar 9, 2014 17:06

I get a new crash :3, and this is gdb message

#0 0x081b4ef4 in set_reg (st=0xb62184a4, sd=0x0, num=16186,
name=0x8b570f3 ".hexbase$", value=0xb4684e7d, ref=0x0) at script.c:2876
n = <value optimized out>
str = 0xb4684e7d "0"
prefix = 46 '.'
__FUNCTION__ = "set_reg"
#1 0x081ab2b1 in buildin_setarray (st=0xb62184a4) at script.c:5670
data = 0xb45c7314
name = 0x8b570f3 ".hexbase$"
start = <value optimized out>
end = 17
id = 16186
i = <value optimized out>
sd = 0x0
#2 0x081ac56e in run_func (st=0xb62184a4) at script.c:3693
data = 0xb45c72f4
i = <value optimized out>
start_sp = <value optimized out>
end_sp = <value optimized out>
func = 26
#3 0x081b6d1e in run_script_main (st=0xb62184a4) at script.c:3911
c = C_FUNC
cmdcount = 65533983

This post has been edited by ahmadshidqi on Mar 9, 2014 17:06

Haru - Mar 9, 2014 17:21

Can you show line 2876 of your script.c (and possibly, the relevant part from the script where the .hexbase$ variable is defined, it doesn't seem like an official script)

ahmadshidqi - Mar 9, 2014 17:27

[quote]

int set_reg(struct script_state* st, TBL_PC* sd, int64 num, const char* name, const void* value, struct reg_db *ref) {
char prefix = name[0];

if( is_string_variable(name) ) {// string variable
const char *str = (const char*)value;

switch (prefix) {
case '@':
pc->setregstr(sd, num, str);
return 1;
case '$':
return mapreg->setregstr(num, str);
case '#':
return (name[1] == '#') ?
pc_setaccountreg2str(sd, num, str) :
pc_setaccountregstr(sd, num, str);
case '.':
{
struct reg_db *n = (ref) ? ref : (name[1] == '@') ? &st->stack->scope : &st->script->local;
if( n ) {
if (str[0]) {
i64db_put(n->vars, num, aStrdup(str)); <---------- HERE
if( script_getvaridx(num) )
script->array_update(n, num, false);
} else {
i64db_remove(n->vars, num);
if( script_getvaridx(num) )
script->array_update(n, num, true);
}
}
}
return 1;
case '\'':
if( st->instance_id >= 0 ) {
if( str[0] ) {
i64db_put(instance->list[st->instance_id].regs.vars, num, aStrdup(str));
if( script_getvaridx(num) )
script->array_update(&instance->list[st->instance_id].regs, num, false);
} else {
i64db_remove(instance->list[st->instance_id].regs.vars, num);
if( script_getvaridx(num) )
script->array_update(&instance->list[st->instance_id].regs, num, true);
}
} else {
ShowError("script_set_reg: cannot write instance variable '%s', NPC not in a instance!\n", name);
script_reportsrc(st);
}
return 1;
default:
return pc_setglobalreg_str(sd, num, str);
}[/quote]

Haru - Mar 10, 2014 1:29

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

ahmadshidqi - Mar 10, 2014 1:44

thankyou sir

ahmadshidqi - Mar 10, 2014 1:44

thankyou sir