Avoid undefined on array.length when null array assigned

When a null array is assigned to the ng-repeat this causes a js error