1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Fortify CLabel interface to prevent unchecked access

This commit is contained in:
Ivan Savenko
2022-12-19 22:04:50 +02:00
parent 87ba221415
commit d29c9d6445
10 changed files with 33 additions and 21 deletions

View File

@@ -321,9 +321,9 @@ CChatBox::CChatBox(const Rect & rect)
void CChatBox::keyPressed(const SDL_KeyboardEvent & key)
{
if(key.keysym.sym == SDLK_RETURN && key.state == SDL_PRESSED && inputBox->text.size())
if(key.keysym.sym == SDLK_RETURN && key.state == SDL_PRESSED && inputBox->getText().size())
{
CSH->sendMessage(inputBox->text);
CSH->sendMessage(inputBox->getText());
inputBox->setText("");
}
else
@@ -333,7 +333,7 @@ void CChatBox::keyPressed(const SDL_KeyboardEvent & key)
void CChatBox::addNewMessage(const std::string & text)
{
CCS->soundh->playSound("CHAT");
chatHistory->setText(chatHistory->label->text + text + "\n");
chatHistory->setText(chatHistory->label->getText() + text + "\n");
if(chatHistory->slider)
chatHistory->slider->moveToMax();
}