Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1105925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:42:42+00:00 2026-05-17T01:42:42+00:00

I have a problem with a random crash caused by CSceneNode* pRoot = nodes[0];

  • 0

I have a problem with a random crash caused by CSceneNode* pRoot = nodes[0]; // The real problem is = nodes[0];
Crash message is: The instruction at “0x0059d383” referenced memory at “0x00000000”. The memory cound not be “read”.
I do not see the problem, could please help me out ?

In Save.cpp

void CNESave::SaveLocation(CNELocation* pLoc)
// Other code

    CSceneNode* scene = pLoc->GetScene();
    vector<CSceneNode*> nodes;          
    scene->GetNodes(GetNodesByPartOfName, nodes, &string("_Ldynamic"));
    CSceneNode* pRoot = nodes[0];   //This is the problem causing random crashes!
        // If I change it (just for testing) to CSceneNode* pRoot = scene 
        // them it isn't crashing.
        // So CSceneNode* pRoot is OK and the problematic part is = nodes[0];

In SceneNode.cpp

bool GetNodesByPartOfName(CSceneNode* node, const void *data)
{
    string *str = (string *)data;
    return node->GetName().find(*str)!=npos;
}

void CSceneNode::GetNodes( GetNodesFunc gf, vector<CSceneNode*> &nodes, 
   const void *data)
{
    if (gf(this, data)) nodes.push_back(this);
    SceneNodeIterator begin=FirstChild(), end=LastChild();
    for (;begin!=end;begin++) ((CSceneNode*)*begin)->GetNodes(gf, nodes, data);
}

CSceneNode* CSceneNode::CreateNew() 
{
    return new CSceneNode();
}

// a lot of other code

In SceneNode.h

class EXPORTDECL CSceneNode;
typedef bool (*GetNodesFunc)(CSceneNode *node, const void *data);
EXPORTDECL bool GetNodesByPartOfName(CSceneNode* node, const void *data);
typedef vector<CSceneNode*>::iterator SceneNodeIterator;
class EXPORTDECL CSceneNode : public CTreeNode<CSceneNode, true>  
{
public:
//construction & destruction
    CSceneNode();
    virtual ~CSceneNode();
    virtual CSceneNode *CreateNew();
// a lot of other code

Solved. Thank you guys very much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:42:43+00:00Added an answer on May 17, 2026 at 1:42 am

    If the result of node->GetName() does not contain the string _Ldynamic, this will crash.

    Because in this case GetNodesByPartOfName(..) will return false and GetNodes(..) will not execute nodes.push_back(this) and you will be left with an empty vector and later will try to access the first element of this empty vector after returning from GetNodes(..).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.