I've been working on a game engine for the past 2 weeks, I've run into some wierd errors throughout my time, but this one takes the pie. I've debugged it from start to finish, watching the addresses carefully. I noticed that the function that causes the error SETS an argument to 0x00000000 or NULL and that seems to be causing the access violation. I watched that argument all the way down to the function and it's definitely not NULL. Here's some code:
Error Function
And the call:Code:BOOL ArkButton::Init(ArkCore *Ark, LPCTSTR TextureFilename, int MaxButtons) { if( Ark == NULL || TextureFilename == NULL || MaxButtons == NULL ) return FALSE; if( Ark->GetDevice() == NULL ) return FALSE; *m_Button = new sButton[MaxButtons]; if(FAILED(D3DXCreateTextureFromFile(Ark->GetDevice(), TextureFilename, &m_Texture))) // ACCESS VIOLATION, ARK IS THE SUPPOSED NULL OBJECT(NOTE THE CHECK FOR IT) return FALSE;
I'm stumped, any ideas?Code:/* PRE INSTANTIATED OBJECTS ********** ArkCore* AC; ArkButton* AB; **********************************/ AB->Init(AC, "C:\\UI\\Buttons.jpg", 2); // The call



LinkBack URL
About LinkBacks



I suspect you're setting a pointer to NULL, rather than setting whatever the pointer points-to to NULL.