Commit 388bc701 authored by Benoît Minisini's avatar Benoît Minisini

Don't crash when drawing one-character static strings.

[GB.SDL2]
* BUG: Don't crash when drawing one-character static strings.
parent 23a8fbc8
......@@ -327,6 +327,8 @@ BEGIN_METHOD(Draw_Image, GB_OBJECT image; GB_INTEGER x; GB_INTEGER y; GB_INTEGER
else
rect = NULL;
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
if (MISSING(opacity) && MISSING(angle))
SDL_RenderCopy(RENDERER, texture, rect, &dest);
else
......
......@@ -245,9 +245,9 @@ SDL_Image *FONT_render_text(CFONT *_object, CWINDOW *window, char *text, int len
{
SDL_Color color = { 0xFF, 0xFF, 0xFF, 0xFF };
char c = text[len];
text[len] = 0;
if (c) text[len] = 0;
surface = TTF_RenderUTF8_Blended(THIS->font, text, color);
text[len] = c;
if (c) text[len] = c;
*w = surface->w;
*h = surface->h;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment