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

Dictionary .get corrupts variable on failure #176

Open
asumagic opened this issue Oct 18, 2023 · 1 comment
Open

Dictionary .get corrupts variable on failure #176

asumagic opened this issue Oct 18, 2023 · 1 comment
Labels
angelscript AngelScript update related issue asjit AngelScript JIT related issue bug Something isn't working

Comments

@asumagic
Copy link
Owner

Not 100% sure as I didn't diagnose in too deep but it seemed to be what caused #167.

See:

s32 ReadCost(ConfigFile cfg, dictionary@ costs, const string &in cost_name, s32 &in cost)
{
	if (!costs.get(cost_name, cost) && cfg.exists(cost_name))
	{
		cost = cfg.read_s32(cost_name, cost);
		costs.set(cost_name, cost);
	}

	return cost;
}

Changing the type of cost to s32 (instead of s32 &in) did not help.

@asumagic asumagic added bug Something isn't working angelscript AngelScript update related issue asjit AngelScript JIT related issue labels Oct 18, 2023
@asumagic asumagic changed the title Dictionary .get might corrupt output variable if it fails Dictionary .get corrupts variable on failure Oct 19, 2023
@asumagic
Copy link
Owner Author

repro: int test = 123; dictionary foo; foo.get("foo", test); print(''+test)
80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
angelscript AngelScript update related issue asjit AngelScript JIT related issue bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant