From e3ef67d617bd846cfb9e65a274de8ae11b66c282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Bourdelin?= Date: Tue, 8 Oct 2013 11:33:00 -0400 Subject: [PATCH] model.js: fix an error when parsing null string Avoiding error when accessing a null string in map. --- js/models.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/models.js b/js/models.js index f3174e5..1d4ca83 100644 --- a/js/models.js +++ b/js/models.js @@ -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