null pointer check

This commit is contained in:
Jacek Jendrzej
2017-08-23 13:03:34 +02:00
parent e58e72635b
commit 527c0de33a
2 changed files with 12 additions and 10 deletions

View File

@@ -99,16 +99,18 @@ void Helpbox::addLine(const std::string& icon, const std::string& text, const in
if (!text.empty()){
int x_text = w_picon + (picon ? OFFSET_INNER_MID : 0);
CComponentsText * txt = new CComponentsText(x_text, 0, line->getWidth()-x_text, 0, text, text_mode, font);
txt->doPaintBg(false);
txt->forceTextPaint();
if(txt){
txt->doPaintBg(false);
txt->forceTextPaint();
#if 0 //"contrast agent", if you want to see where the text items are drawn.
txt->setColorBody(COL_RED);
#endif
int lines = txt->getCTextBoxObject()->getLines();
txt_height = std::max(lines*font->getHeight(), h_line);
txt->setHeight(txt_height);
int lines = txt->getCTextBoxObject()->getLines();
txt_height = std::max(lines*font->getHeight(), h_line);
txt->setHeight(txt_height);
line->addCCItem(txt);
line->addCCItem(txt);
}
}
if (txt_height > line->getHeight())