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); { "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), NULL, &tgt);
//show the current panel title (stored in _title) //show the current panel title (stored in _title)
TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), //if its blank, dont show anything
_title.c_str(), if(!_title.empty()){
&tgt.w, &tgt.h); TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }),
tgt.x = 5; tgt.y = -5; _title.c_str(),
SDL_RenderCopy(board::getRenderer(), &tgt.w, &tgt.h);
board::getString(_title, tgt.x = 5; tgt.y = -5;
{ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), NULL, &tgt); SDL_RenderCopy(board::getRenderer(),
board::getString(_title,
{ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), NULL, &tgt);
}