Encompass all the _colorTable in the check for null

Possible dereference after null - move the if() to include all checks
wilder-portage
Kurt Hindenburg 12 years ago
parent ffd9e56cce
commit e6316eb4d8
  1. 23
      src/TerminalCharacterDecoder.cpp

@ -210,20 +210,21 @@ void HTMLDecoder::decodeLine(const Character* const characters, int count, LineP
QString style;
bool useBold;
ColorEntry::FontWeight weight = characters[i].fontWeight(_colorTable);
if (weight == ColorEntry::UseCurrentFormat)
useBold = _lastRendition & RE_BOLD;
else
useBold = weight == ColorEntry::Bold;
if (useBold)
style.append("font-weight:bold;");
if (_lastRendition & RE_UNDERLINE)
style.append("font-decoration:underline;");
//colors - a color table must have been defined first
if (_colorTable) {
ColorEntry::FontWeight weight = characters[i].fontWeight(_colorTable);
if (weight == ColorEntry::UseCurrentFormat)
useBold = _lastRendition & RE_BOLD;
else
useBold = weight == ColorEntry::Bold;
if (useBold)
style.append("font-weight:bold;");
if (_lastRendition & RE_UNDERLINE)
style.append("font-decoration:underline;");
style.append(QString("color:%1;").arg(_lastForeColor.color(_colorTable).name()));
style.append(QString("background-color:%1;").arg(_lastBackColor.color(_colorTable).name()));

Loading…
Cancel
Save