diff --git a/index.html b/index.html index 5a354b627..0039edaf8 100644 --- a/index.html +++ b/index.html @@ -410,7 +410,7 @@
Create a New Address
diff --git a/js/filters.js b/js/filters.js index 6b0a99ab0..42848fe4c 100644 --- a/js/filters.js +++ b/js/filters.js @@ -19,6 +19,7 @@ angular.module('copayApp.filters', []) }) .filter('removeEmpty', function() { return function(elements) { + elements = elements || []; // Hide empty addresses from other copayers return elements.filter(function(e) { return e.owned || e.balance > 0; diff --git a/test/unit/filters/filtersSpec.js b/test/unit/filters/filtersSpec.js index 1b3f3acc2..d2be6e694 100644 --- a/test/unit/filters/filtersSpec.js +++ b/test/unit/filters/filtersSpec.js @@ -75,6 +75,11 @@ describe('Unit: Testing Filters', function() { expect(removeEmpty([]).length).to.equal(0); })); + it('should work with undefined', inject(function($filter) { + var removeEmpty = $filter('removeEmpty'); + expect(removeEmpty(undefined).length).to.equal(0); + })); + it('should filter empty addresses from other copayers', inject(function($filter) { var removeEmpty = $filter('removeEmpty'); var addresses = [{