model.js: fix an error when parsing null string

Avoiding error when accessing a null string in map.
This commit is contained in:
Sébastien Bourdelin 2013-10-08 11:33:00 -04:00
parent c4697feede
commit e3ef67d617

View file

@ -51,7 +51,7 @@ models.service('models', ['colors', function(colors) {
var buffer = message['objects'][0]['content'][0]['buffer'];
text_elements = _.union(prefix, text);
text_elements =_.map(text_elements, function(text_element) {
if ('fg' in text_element) {
if (text_element && ('fg' in text_element)) {
text_element['fg'] = colors.prepareCss(text_element['fg']);
}
// TODO: parse background as well