How to handle Access violations.

Started by
13 comments, last by Enerjak 16 years, 2 months ago
Ok, there seems to be something wrong with this code.

void Cor_CDirect3D9Renderer::Cor_Sync(){HRESULT result = Cor_Direct3DDevice9->Clear(0,0,D3DCLEAR_TARGET,D3DCOLOR_XRGB(255,0,0),1.0f,1);	if(FAILED(result))	{		return 0;	}		if(Cor_Direct3DDevice9->BeginScene())	{		Cor_Direct3DDevice9->EndScene();	}	Cor_Direct3DDevice9->Present(NULL,NULL,NULL,NULL);}


I see nothing wrong with this. but who knows. I also put this in the main loop in WinMain because i found out that things don't have to be places exactly in between begin/endScene you can draw everything as long as you can a function that updates the screen.
Anyways, when i take out the Cor_Sync() it works fine. but yeah, i need that to render so any advice would be helpfull. thanks
Advertisement
Step through that function in your debugger. What is the value of Cor_Direct3DDevice9?
0x00000000000. it just doesn't seem to like the variable. I don't know why. What can it be done with this? also it says Line 45 + 0x21. Anything i can do? cause Cor_Direct3DDevice9 is only giving me problems in that function.
Quote:Original post by Enerjak
0x00000000000. it just doesn't seem to like the variable. I don't know why. What can it be done with this? also it says Line 45 + 0x21. Anything i can do? cause Cor_Direct3DDevice9 is only giving me problems in that function.



That would be a NULL pointer.


Quote:Access violations shouldn't get in your way any more.


A: Sir, klaxons are going off, red lights are blinking, and the nuclear reactor is making strange noises!!!
B: There's a switch at the back, that will turn off these annoyances, flip it

* The above is loose transcription of the discussion between two technicians in Chernobyl power plant. And yes, it worked perfectly. A few minutes later, everything was quiet. It remains quiet to this day.
I take it your either telling me i'm a dumb ass or something else. i can't quite make it out. Well, what ever it is, i'll figure it out. gotta.

OH wait you were talking to the other guy

[Edited by - Enerjak on January 30, 2008 9:14:35 PM]

This topic is closed to new replies.

Advertisement