In my (DarkGDK) game I keep getting the "access violation writing location 0x00000000" error. I've searched for information about this error and it seems it has to do with accessing a NULL pointer, which obviously explains the 0x00000000 address.
Visual C++ 2008 keeps pointing at the second line of
after the error accurs, but I don't see how that is relevant, there are no pointers in that part. Does this mean I should look elsewhere in my code, or is it something in that 'function' that I don't understand?
Firstly, try commenting this line. If the error remains, you have to look somewhere else.
Is SetCollisionType a method? If so, could it be that it is at some point called from a pointer that is null?
Oh hamsterman, I'm sorry I missed your post so I replied to Dufresne's post.
If I'm right, the pointer isn't 0, I set it to 0 when constructing the class it belongs to though, is that wrong? Because right after that I give it another value:
In that function you are implicitly using this-> access colCollisionType inside your class.
Your this is probably NULL (as has been said), so I suggest you put a breakpoint before that section and see if you can find out when exactly your class is becoming a NULL pointer.
My god, I can't believe it. I didn't realize there was "CTile*" in front of "ptTileTypeArray". "ptTileTypeArray" already exists outside that function and I meant to use that one, because that's the one calling the members of CTile. But, because I copied (btw totally unnessecary) the address of tTileTypeArray to the local ptTileTypeArray, the member-calling ptTileTypeArray was still NULL.
Thanks anyway for the help, now let's see if I can fix the next couple of run-time errors.