diff --git a/libobs/graphics/graphics.c b/libobs/graphics/graphics.c index 1a8441013..ffbf89e50 100644 --- a/libobs/graphics/graphics.c +++ b/libobs/graphics/graphics.c @@ -965,19 +965,24 @@ void gs_draw_sprite(gs_texture_t *tex, uint32_t flip, uint32_t width, float fcx, fcy; struct gs_vb_data *data; - if (!gs_valid_p("gs_draw_sprite", tex)) - return; - - if (gs_get_texture_type(tex) != GS_TEXTURE_2D) { - blog(LOG_ERROR, "A sprite must be a 2D texture"); - return; + if (tex) { + if (gs_get_texture_type(tex) != GS_TEXTURE_2D) { + blog(LOG_ERROR, "A sprite must be a 2D texture"); + return; + } + } else { + if (!width || !height) { + blog(LOG_ERROR, "A sprite cannot be drawn without " + "a width/height"); + return; + } } fcx = width ? (float)width : (float)gs_texture_get_width(tex); fcy = height ? (float)height : (float)gs_texture_get_height(tex); data = gs_vertexbuffer_get_data(graphics->sprite_buffer); - if (gs_texture_is_rect(tex)) + if (tex && gs_texture_is_rect(tex)) build_sprite_rect(data, tex, fcx, fcy, flip); else build_sprite_norm(data, fcx, fcy, flip);