Re: Extraction Crash

From: Edward Glamkowski (EGlamkowski@MATHEMATICA-MPR.COM)
Date: 10/20/97


>>> > Well, the best I can offer is that you do not test for
>>> > the null condition of temp->next.  Thus you are probably
>>> > seg faulting here. Try:
>>> >  while (temp && temp->next && (temp->next != obj))
>>> >
>>> > Not sure this is it, but its a good idea to always check
>>> > for the NULL condition anyway.
>>
>>I tried that as well. As soon as I try to access temp->next in ANY form,
>>the crash hits with a seg fault. :(

There was quite a bit of discussion a long time ago
about using <struct>->next in loop conditions.
If I remember correctly, it could all be summarized with:
don't do it.

Do something instead like:
while (temp && next_temp && (next_temp != obj)) {
    next_temp = temp->next;
    etc.
}


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST