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,6 +99,7 @@ void Helpbox::addLine(const std::string& icon, const std::string& text, const in
if (!text.empty()){ if (!text.empty()){
int x_text = w_picon + (picon ? OFFSET_INNER_MID : 0); 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); CComponentsText * txt = new CComponentsText(x_text, 0, line->getWidth()-x_text, 0, text, text_mode, font);
if(txt){
txt->doPaintBg(false); txt->doPaintBg(false);
txt->forceTextPaint(); txt->forceTextPaint();
#if 0 //"contrast agent", if you want to see where the text items are drawn. #if 0 //"contrast agent", if you want to see where the text items are drawn.
@@ -110,6 +111,7 @@ void Helpbox::addLine(const std::string& icon, const std::string& text, const in
line->addCCItem(txt); line->addCCItem(txt);
} }
}
if (txt_height > line->getHeight()) if (txt_height > line->getHeight())
line->setHeight(txt_height); line->setHeight(txt_height);

View File

@@ -58,10 +58,10 @@
#include <gui/widget/icons.h> #include <gui/widget/icons.h>
#include <driver/fontrenderer.h> #include <driver/fontrenderer.h>
#define MAX_WINDOW_WIDTH (frameBuffer->getScreenWidth() - 40) #define MAX_WINDOW_WIDTH (frameBuffer ? frameBuffer->getScreenWidth() - 40:0)
#define MAX_WINDOW_HEIGHT (frameBuffer->getScreenHeight() - 40) #define MAX_WINDOW_HEIGHT (frameBuffer ? frameBuffer->getScreenHeight() - 40:0)
#define MIN_WINDOW_WIDTH (frameBuffer->getScreenWidth() >> 1) #define MIN_WINDOW_WIDTH (frameBuffer ? frameBuffer->getScreenWidth() >> 1:0)
#define MIN_WINDOW_HEIGHT 40 #define MIN_WINDOW_HEIGHT 40
#define TITLE_BACKGROUND_COLOR COL_MENUHEAD_PLUS_0 #define TITLE_BACKGROUND_COLOR COL_MENUHEAD_PLUS_0