Fix crash with bogus shape index to DisplayServer.cursor_set_custom_image()

Fixes #66605.
This commit is contained in:
Rémi Verschelde
2023-02-17 14:17:37 +01:00
parent f0c9ed4b55
commit 4574b97752
5 changed files with 9 additions and 0 deletions

View File

@@ -395,6 +395,7 @@ DisplayServer::CursorShape DisplayServerWeb::cursor_get_shape() const {
}
void DisplayServerWeb::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
if (p_cursor.is_valid()) {
Ref<Texture2D> texture = p_cursor;
Ref<AtlasTexture> atlas_texture = p_cursor;