Permalink
Browse files

fix(autocomplete): Fix TypeError in autocomplete. (#10227)

Fix TypeError/NPE in Autocomplete when assuming `$scope.searchText`
was available.
  • Loading branch information...
1 parent bb90ce9 commit f8fd0762cdeb54fc1327e201dc38e101c08abaa3 @topherfangio topherfangio committed with tinayuangao Jan 11, 2017
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/components/autocomplete/js/autocompleteController.js
@@ -399,7 +399,8 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
// Clear the searchText, when the selectedItem is set to null.
// Do not clear the searchText, when the searchText isn't matching with the previous
// selected item.
- if (displayValue.toString().toLowerCase() === $scope.searchText.toLowerCase()) {
+ if (angular.isString($scope.searchText)
+ && displayValue.toString().toLowerCase() === $scope.searchText.toLowerCase()) {
$scope.searchText = '';
}
});

0 comments on commit f8fd076

Please sign in to comment.