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

Check for null in set_pattern() #77440

Merged

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented May 24, 2023

Fixes #77422
The last argument of the method is a reference to TileMapPattern, not an int.

This exposed a deeper issue. The method is called with 0 used as Ref<TileMapPattern> (effectively null). GDScript will call it without any validation and cause a crash. After I added the null check, only then you will get an error about invalid arguments (only after the method is called and fails).

@KoBeWi KoBeWi added this to the 4.1 milestone May 24, 2023
@KoBeWi KoBeWi requested a review from a team as a code owner May 24, 2023 14:42
@KoBeWi KoBeWi force-pushed the set_pattern_which_doesn't_exist branch from 77aae88 to 9128ce9 Compare May 24, 2023 14:43
@akien-mga akien-mga merged commit 4c677c8 into godotengine:master May 24, 2023
@akien-mga
Copy link
Member

Thanks!

@KoBeWi KoBeWi deleted the set_pattern_which_doesn't_exist branch May 24, 2023 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TileMap.set_pattern causing game to silently crash
3 participants