You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 17:36:07 +00:00
Merge pull request #18718 from guilhermefelipecgs/fix_crash_for_invalid_reference
[2.1] Prevent crash for invalid reference
This commit is contained in:
@@ -1216,7 +1216,7 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
|
||||
|
||||
texture_size.width = atlas_texture->get_region().size.x;
|
||||
texture_size.height = atlas_texture->get_region().size.y;
|
||||
} else {
|
||||
} else if (texture.is_valid()) {
|
||||
texture_size.width = texture->get_width();
|
||||
texture_size.height = texture->get_height();
|
||||
}
|
||||
@@ -1257,7 +1257,7 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
|
||||
uint32_t color = image.get_pixel(column_index, row_index).to_ARGB32();
|
||||
|
||||
uint8_t alpha = (color >> 24) & 0xFF;
|
||||
pixels[i * 4 + 0] = ((color >> 16) & 0xFF) * alpha / 255;
|
||||
pixels[i * 4 + 0] = ((color >> 16) & 0xFF) * alpha / 255;
|
||||
pixels[i * 4 + 1] = ((color >> 8) & 0xFF) * alpha / 255;
|
||||
pixels[i * 4 + 2] = ((color) & 0xFF) * alpha / 255;
|
||||
pixels[i * 4 + 3] = alpha;
|
||||
|
||||
@@ -2003,7 +2003,7 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
|
||||
|
||||
texture_size.width = atlas_texture->get_region().size.x;
|
||||
texture_size.height = atlas_texture->get_region().size.y;
|
||||
} else {
|
||||
} else if (texture.is_valid()) {
|
||||
texture_size.width = texture->get_width();
|
||||
texture_size.height = texture->get_height();
|
||||
}
|
||||
|
||||
@@ -2177,7 +2177,7 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
|
||||
|
||||
texture_size.width = atlas_texture->get_region().size.x;
|
||||
texture_size.height = atlas_texture->get_region().size.y;
|
||||
} else {
|
||||
} else if (texture.is_valid()) {
|
||||
texture_size.width = texture->get_width();
|
||||
texture_size.height = texture->get_height();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user