Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop with try/catch inside for loop #126

Closed
TGlas opened this issue Nov 18, 2022 · 0 comments
Closed

Infinite loop with try/catch inside for loop #126

TGlas opened this issue Nov 18, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@TGlas
Copy link
Owner

TGlas commented Nov 18, 2022

Description

Catching an exception inside of a for-loop can mess with the loop counter.

To Reproduce

Example code:

for 0:1 do
{
	try
	{
		print("inside");
		test(expr());
	}
	catch var ex do
	{ }
}
print("done");

function expr() { throw "error"; }
function test(val) {}

Interestingly, replacing test(expr()); with expr(); changes the behavior back to normal.

What should happen instead: The loop should terminate.

@TGlas TGlas added the bug Something isn't working label Nov 18, 2022
@TGlas TGlas closed this as completed in 41b58ea Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant