diff --git a/static/js/controllers.js b/static/js/controllers.js index 1bb907bb0..d52267cf1 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -539,6 +539,8 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi $scope.setTag = function(tagName, opt_updateURL) { var repo = $scope.repo; + if (!repo) { return; } + var proposedTag = repo.tags[tagName]; if (!proposedTag) { // We must find a good default @@ -551,15 +553,15 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi if (proposedTag) { $scope.currentTag = proposedTag; - $scope.currentImage = $scope.currentTag.image; + $scope.currentImage = proposedTag.image; $scope.loadImageChanges($scope.currentImage); if ($scope.tree) { - $scope.tree.setTag($scope.currentTag.name); + $scope.tree.setTag(proposedTag.name); } if (opt_updateURL) { $location.search('image', null); - $location.search('tag', $scope.currentTag.name); + $location.search('tag', proposedTag.name); } }