Add error checking for blank _title string

This commit is contained in:
Tyler Perkins 2021-12-22 12:57:57 -05:00
parent ae85dae6e9
commit 23629bc4cf
1 changed files with 10 additions and 7 deletions

View File

@ -122,13 +122,16 @@ void def_overlay::update_texture() {
{ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), NULL, &tgt);
//show the current panel title (stored in _title)
TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }),
_title.c_str(),
&tgt.w, &tgt.h);
tgt.x = 5; tgt.y = -5;
SDL_RenderCopy(board::getRenderer(),
board::getString(_title,
{ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), NULL, &tgt);
//if its blank, dont show anything
if(!_title.empty()){
TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }),
_title.c_str(),
&tgt.w, &tgt.h);
tgt.x = 5; tgt.y = -5;
SDL_RenderCopy(board::getRenderer(),
board::getString(_title,
{ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), NULL, &tgt);
}