Merge pull request #73500 from akien-mga/out-of-shape
Fix crash with bogus shape index to DisplayServer.cursor_set_custom_image()
This commit is contained in:
commit
633d9e6327
|
@ -656,6 +656,7 @@ void DisplayServerAndroid::_cursor_set_shape_helper(CursorShape p_shape, bool fo
|
|||
}
|
||||
|
||||
void DisplayServerAndroid::cursor_set_shape(DisplayServer::CursorShape p_shape) {
|
||||
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
|
||||
_cursor_set_shape_helper(p_shape);
|
||||
}
|
||||
|
||||
|
@ -664,6 +665,7 @@ DisplayServer::CursorShape DisplayServerAndroid::cursor_get_shape() const {
|
|||
}
|
||||
|
||||
void DisplayServerAndroid::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
|
||||
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
|
||||
String cursor_path = p_cursor.is_valid() ? p_cursor->get_path() : "";
|
||||
if (!cursor_path.is_empty()) {
|
||||
cursor_path = ProjectSettings::get_singleton()->globalize_path(cursor_path);
|
||||
|
|
|
@ -2599,6 +2599,8 @@ DisplayServerX11::CursorShape DisplayServerX11::cursor_get_shape() const {
|
|||
void DisplayServerX11::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
|
||||
|
||||
if (p_cursor.is_valid()) {
|
||||
HashMap<CursorShape, Vector<Variant>>::Iterator cursor_c = cursors_cache.find(p_shape);
|
||||
|
||||
|
|
|
@ -3284,6 +3284,8 @@ DisplayServerMacOS::CursorShape DisplayServerMacOS::cursor_get_shape() const {
|
|||
void DisplayServerMacOS::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
|
||||
|
||||
if (p_cursor.is_valid()) {
|
||||
HashMap<CursorShape, Vector<Variant>>::Iterator cursor_c = cursors_cache.find(p_shape);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1719,6 +1719,8 @@ DisplayServer::CursorShape DisplayServerWindows::cursor_get_shape() const {
|
|||
void DisplayServerWindows::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
|
||||
|
||||
if (p_cursor.is_valid()) {
|
||||
RBMap<CursorShape, Vector<Variant>>::Element *cursor_c = cursors_cache.find(p_shape);
|
||||
|
||||
|
|
Loading…
Reference in New Issue