color: ignore effects missing from terminfo

If terminfo mode is in effect, and an effect is used which is missing from
the terminfo database, simply silently ignore the request, leaving the
output unaffected rather than causing a crash.
This commit is contained in:
Danek Duvall 2016-10-13 12:01:41 -07:00
parent fb575a9782
commit 36e57eb638

View File

@ -378,7 +378,10 @@ def _effect_str(effect):
if effect.endswith('_background'):
bg = True
effect = effect[:-11]
attr, val, termcode = _terminfo_params[effect]
try:
attr, val, termcode = _terminfo_params[effect]
except KeyError:
return ''
if attr:
if termcode:
return termcode