From ef1c83da8968b05fdcdb9519644ae8db4f3bd63f Mon Sep 17 00:00:00 2001 From: korenkonder Date: Wed, 27 Dec 2023 14:58:31 +0300 Subject: [PATCH] Fix potential crash on sprite draw caused by null ref --- src/CRE/sprite.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CRE/sprite.cpp b/src/CRE/sprite.cpp index 0b0084ba..8a6e4a23 100644 --- a/src/CRE/sprite.cpp +++ b/src/CRE/sprite.cpp @@ -1613,7 +1613,7 @@ namespace spr { } break; case 1: - draw_param.texture[0] = tex_param[0].texture->tex; + draw_param.texture[0] = tex_param[0].texture ? tex_param[0].texture->tex : 0; draw_param.sampler = rctx->sprite_samplers[0]; if (args.num_vertex) { @@ -1756,8 +1756,8 @@ namespace spr { return; } - draw_param.texture[0] = tex_param[0].texture->tex; - draw_param.texture[1] = tex_param[1].texture->tex; + draw_param.texture[0] = tex_param[0].texture ? tex_param[0].texture->tex : 0; + draw_param.texture[1] = tex_param[1].texture ? tex_param[1].texture->tex : 0; draw_param.sampler = rctx->sprite_samplers[2]; sprite_draw_vertex spr_vtx[4] = {};