Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Crash at RETURN command?!

Author
Message
BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 29th Aug 2010 02:25
Short question is: does anyone know what might cause a program to crash at the RETURN command?

I just rem'd out a block of code in a subroutine, and now the command seems to be causing a "Fields has stopped working..."-type crash. I used a plugin to make a message box pop up just before the RETURN command, and a different box directly after the subroutine. Only the first box appears before the crash.

Windows offered to debug it with Visual Studio, but the VS debugger proceeded to crash as well


Latest progress: Fog of War implemented; frustrated by pathfinding >.>
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 29th Aug 2010 02:27
There's most probably a mismatched call and or return.

BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 29th Aug 2010 02:37
I'm not 100% certain what you mean, but I'm not doing anything more complicated with subroutines than calling them from my main loop. None of them so much as call another subroutine, they just run and then jump back. Could you elaborate?


Latest progress: Fog of War implemented; frustrated by pathfinding >.>
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 29th Aug 2010 03:38
Did you rem from before the subroutine name, until after the return statement?
Did you remember to rem out all the calling gosub commands?
Can we have some sample code to work from?

My signature is NOT a moderator plaything! Stop changing it!
BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 29th Aug 2010 03:41 Edited at: 29th Aug 2010 03:42
I probably overreacted when I posted this, I managed to solve the problem by commenting out segments of the subroutine one at a time. The program stopped crashing after I commented out this debug code:



It turns out one of the bits I'd removed was the declaration of the Paths array, though why this caused a crash at the return command instead of a handy "Array does not exist at line xxx" error is beyond me.

EDIT: Thanks for your help anyway Mobiius, and Kevin .


Latest progress: Fog of War implemented; frustrated by pathfinding >.>

Login to post a reply

Server time is: 2026-07-23 12:10:02
Your offset time is: 2026-07-23 12:10:02