1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-06 17:25:19 +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:
Rémi Verschelde
2018-05-11 14:23:49 +02:00
committed by GitHub
3 changed files with 4 additions and 4 deletions

View File

@@ -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;

View File

@@ -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();
}

View File

@@ -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();
}