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

[GB.SDL2]
* BUG: Don't crash when drawing one-character static strings.
This commit is contained in:
gambas 2019-01-13 08:58:00 +01:00
parent 23a8fbc81d
commit 388bc70157
2 changed files with 4 additions and 2 deletions

View file

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

View file

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