mirror of https://github.com/godotengine/godot
Merge pull request #18718 from guilhermefelipecgs/fix_crash_for_invalid_reference
[2.1] Prevent crash for invalid reference
This commit is contained in:
commit
1bf7242bb2
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue