29 Sep, 2009, JohnnyStarr wrote in the 1st comment:
Votes: 0
I cant understand why ch->desc (DESCRIPTOR_DATA *) has a seg fault only certain times when i access it? I wish i had an example to provide, but it wouldn't yield anything because the code doesn't have any issues. Here's all I do:
ch->desc->altmenu = AM_NONE;
which is no different than anything else in the mud that accesses the desc through ch. Has anyone had anything like this?
EDIT: heres what GDB says: Breakpoint 1, _Z12accept_questP9char_dataPc (ch=0x880af4, argument=0x87e8b9 "y") at alt.menu.c:49 (gdb) p *ch->desc Cannot access memory at address 0x0
It works when I explicitly assign: ch->desc = d in the previous function, but I'm worried why the mud doesn't do this in comm.c?
I cant understand why ch->desc (DESCRIPTOR_DATA *) has a seg fault only certain times when i access it? I wish i had an example to provide, but it wouldn't yield anything because the code doesn't have any issues. Here's all I do:
ch->desc->altmenu = AM_NONE;
which is no different than anything else in the mud that accesses the desc through ch. Has anyone had anything like this?
EDIT: heres what GDB says: Breakpoint 1, _Z12accept_questP9char_dataPc (ch=0x880af4, argument=0x87e8b9 "y") at alt.menu.c:49 (gdb) p *ch->desc Cannot access memory at address 0x0
It works when I explicitly assign: ch->desc = d in the previous function, but I'm worried why the mud doesn't do this in comm.c?
You should be testing the descriptor before accessing it.
if(!ch->desc) return;
ch->desc->altmenu = AM_NONE;
or
if(ch->desc) ch->desc->altmenu = AM_NONE;
You should be doing that no matter what. Whether or not the descriptor is set already depends on where you are hooking in.
I wish i had an example to provide, but it wouldn't yield anything because the code doesn't have any issues.
Here's all I do:
which is no different than anything else in the mud that accesses the desc through ch.
Has anyone had anything like this?
EDIT: heres what GDB says:
Breakpoint 1, _Z12accept_questP9char_dataPc (ch=0x880af4, argument=0x87e8b9 "y") at alt.menu.c:49
(gdb) p *ch->desc
Cannot access memory at address 0x0
It works when I explicitly assign: ch->desc = d in the previous function, but I'm worried why the mud doesn't do this in comm.c?