Jump to content
  • Advertisement
Sign in to follow this  
Miles Lombardi

Intermittend pointer error.

This topic is 4605 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

Advertisement
If this is in a program that you coded, run it in a debugger to pinpoint it. If it's in a third-party app, I couldn't say.

Share this post


Link to post
Share on other sites
Sure, I'll try to give a brief rundown.

Hopefully you're working in a visual IDE -- something like Visual Studio, Dev-C++, or Code::Blocks. If you are, try the "debug" command -- in Visual Studio, one of the most-used build menu options. It'll run your program, and when it crashes take you straight to the line of code that caused it to crash.

Visual Studio shows you a "stack trace" by default, which is the functions that your program went through to make it crash: this is very handy, because a lot of times it'll crash inside a library function and you have to get back out to one of your functions to see where it went wrong. In other IDEs, you might have to choose a menu option to see the stack trace once it's broken out into the debugger.

You can also check on the values of your variables in the debugger, and set "breakpoints", which is a place to pause your program and go back to the debugger to see what's going on.

If you aren't using a visual IDE, you'll have to download WinDBG or use a command-line debugger. This is a different can of worms that I won't open right now.

Hope that helps,
Twilight Dragon

Share this post


Link to post
Share on other sites
I think I found out what it is.
Using the backtrace the "blue" line was room, but it couldn't actually take me to that, for some reason, and it had an odd line number 4304, and i don't have that many lines of code.
Anyway, I then noticed that the line before it was an action on a pointer.
Well it's a pointer error. Hmmmm.
This is the line:
sprite_index->draw(varx - view_x - 12, vary - view_y - 20, frame);

The variable frame is then put into a pointer (to an array), and I think effectively the error is something like a GM error "Array index out of bounds".
I think for some reason my programme has made the frame go to more than max_frames, and overstepped the end of the array.
Thanks for the help.
:)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!