Commit 53833b68 authored by Robert Knight's avatar Robert Knight
Browse files

Fix assertion failure when parsing invalid color setting sequences. In such...

Fix assertion failure when parsing invalid color setting sequences.  In such cases, revert back to the default foreground or background color so that the resulting text is at least readable.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=709578
parent 4829812a
......@@ -193,9 +193,17 @@ public:
_w = co;
break;
default:
Q_ASSERT(false);
_colorSpace = COLOR_SPACE_UNDEFINED;
}
}
/**
* Returns true if this character color entry is valid.
*/
bool isValid()
{
return _colorSpace != COLOR_SPACE_UNDEFINED;
}
/**
* Toggles the value of this color between a normal system color and the corresponding intensive
......
......@@ -1241,7 +1241,11 @@ void Screen::setDefaultRendition()
void Screen::setForeColor(int space, int color)
{
cu_fg = CharacterColor(space, color);
effectiveRendition();
if ( cu_fg.isValid() )
effectiveRendition();
else
setForeColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR);
}
/*!
......@@ -1249,7 +1253,11 @@ void Screen::setForeColor(int space, int color)
void Screen::setBackColor(int space, int color)
{
cu_bg = CharacterColor(space, color);
effectiveRendition();
if ( cu_bg.isValid() )
effectiveRendition();
else
setBackColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR);
}
/* ------------------------------------------------------------------------- */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment