[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with Dave's LinkedList



I am using Dave Fanning's LinkedList object and seem to have run into a 
problem with it.  In the procedure Delete_Node, I was getting a Invalid 
Pointer error on line:

IF NOT Ptr_Valid((*currentNode).previous) THEN BEGIN

To me, it looks like the error occurs when the linked list only has one 
node left.  Dave has code that should deal with this condition on line:

IF index EQ (self.count - 1) THEN self->Delete_Last_Node

This code does deal with the above condition, but does not cause 
Delete_Node to exit.  Therefore, the list is empty and tries to execute 
the first line I mentioned; which, causes a runtime error.

I changed the second line I mentioned into the following block of code 
(which seems to fix the error):


IF index EQ (self.count - 1) THEN BEGIN
	self->Delete_Last_Node
	RETURN
END


--
Alan