Skip to content

Commit

Permalink
Added null and undefined handling to highlight filter, closes #123
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashid Khan committed May 29, 2013
1 parent 1818000 commit 916ed28
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion panels/table/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ angular.module('kibana.table', [])
})
.filter('highlight', function() {
return function(text) {
if (text.toString().length) {
if (text.toString().length > 0 && !_.isUndefined(text) && !_.isNull(text)) {
return text.toString().
replace(/&/g, '&').
replace(/</g, '&lt;').
Expand Down

2 comments on commit 916ed28

@gnodet
Copy link

@gnodet gnodet commented on 916ed28 May 30, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the new tests should be put in front of the original one to avoid throwing an exception when calling text.toString() if text is null

@rashidkpc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent point, will update

Please sign in to comment.