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?
29 Sep, 2009, Zeno wrote in the 2nd comment:
Votes: 0
This can indicate the player is no longer connected, aka linkdead. I assume this is not the problem?
29 Sep, 2009, JohnnyStarr wrote in the 3rd comment:
Votes: 0
You know, I saw that in comm.c that that's what it would do, but the really illogical thing, is that
before I call the function, I add
if (ch->desc != NULL)
and it works! what the crap?
29 Sep, 2009, Hyper_Eye wrote in the 4th comment:
Votes: 0
staryavsky said:
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.
0.0/4