Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Problems with my HasParent()

This topic is 5740 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here's the problem: I'm writing my own doubly linked list (see here) and I have a boolean function in my CNode class called 'HasParent()'. This is supposed to come in handy during attachments/detachments, when I need to see if the node already has a parent. Seems logical enough, I think. This is how my HasParent() function goes:
	bool HasParent()
		if(pParent != NULL)
			return true;
			return false;

	} // end HasParent
The project compiles nicely but crashes upon execution. When I debug I'm pointed to the line "if(pParent != NULL);" This may have to do with one of my Attach, AttachTo, or Detach functions. I was never good at debugging (btw, if anyone could point me to some helpful resources online). If my entire CNode code would be of any help, here is the link again: here). Please, any help you can provide. Thanks in advance. // "Programmers don't byte, they nibble a bit." // chimaera [edited by - chimaera on April 1, 2003 5:12:23 PM] [edited by - chimaera on April 1, 2003 10:10:55 PM]

Share this post

Link to post
Share on other sites
If the problem occurs within an Attach() function, the node you''re passing is a NULL pointer. You can fix this with a line at the beginning of your Attach() function like so:

if (pNewNode == NULL)

If it happens within the Detatch() or AttatchTo() functions, the node is somehow getting deleted before it''s finished.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!