diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-30 09:58:58 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-30 09:58:58 +0200 |
commit | fe40c52be89e2e5de53d39fe8ec894b9c2ca2c1e (patch) | |
tree | a7c1cf6b46baad89cc1f3867a904b281b9fbec0f | |
parent | a0d17380fd562468c5caed8695f7752cd99ca38a (diff) | |
parent | ffdac72eaa8691d26965b158cbe314b4dd828f06 (diff) |
Merge pull request #66638 from timothyqiu/rendering-null
Add various null checks in RenderingServer
5 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp index a801b3285a..e18c0ec649 100644 --- a/drivers/gles3/storage/texture_storage.cpp +++ b/drivers/gles3/storage/texture_storage.cpp @@ -666,6 +666,8 @@ void TextureStorage::texture_free(RID p_texture) { } void TextureStorage::texture_2d_initialize(RID p_texture, const Ref<Image> &p_image) { + ERR_FAIL_COND(p_image.is_null()); + Texture texture; texture.width = p_image->get_width(); texture.height = p_image->get_height(); diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp index f169692ea0..a50742f91a 100644 --- a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp @@ -170,6 +170,10 @@ void RendererCompositorRD::finalize() { } void RendererCompositorRD::set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter) { + if (p_image.is_null() || p_image->is_empty()) { + return; + } + RD::get_singleton()->prepare_screen_for_drawing(); RID texture = texture_storage->texture_allocate(); diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 667d910a69..74b8f0890f 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -3621,6 +3621,7 @@ TypedArray<Image> RendererSceneRenderRD::bake_render_uv2(RID p_base, const Typed //RID sampled_light; RenderGeometryInstance *gi = geometry_instance_create(p_base); + ERR_FAIL_NULL_V(gi, TypedArray<Image>()); uint32_t sc = RSG::mesh_storage->mesh_get_surface_count(p_base); Vector<RID> materials; diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp index 1827b73507..b089b96101 100644 --- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp @@ -2021,6 +2021,7 @@ Transform2D MeshStorage::skeleton_bone_get_transform_2d(RID p_skeleton, int p_bo void MeshStorage::skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) { Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton); + ERR_FAIL_NULL(skeleton); ERR_FAIL_COND(!skeleton->use_2d); skeleton->base_transform_2d = p_base_transform; diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp index 800a742cb6..21811068cd 100644 --- a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp @@ -673,6 +673,8 @@ void TextureStorage::texture_free(RID p_texture) { } void TextureStorage::texture_2d_initialize(RID p_texture, const Ref<Image> &p_image) { + ERR_FAIL_COND(p_image.is_null()); + TextureToRDFormat ret_format; Ref<Image> image = _validate_texture_format(p_image, ret_format); |