title: Null value error in AngularJS
body: <p>I am counting how much inventories i have by location name. Everything works, but if <code>location name = null</code> i get errors in my console <code>Cannot read property 'name' of null</code></p>
  
  <pre><code>$scope.stored = function(name) {
          $scope.count = 0;
          for(var i = 0; i &lt; $scope.inventories.length; i++){
              if($scope.inventories[i].location.name == name){
                  $scope.count = $scope.count + 1;
              } 
          }
              return $scope.count;
          };
  </code></pre>