From 4282977e902eb4ef2fb08d4ddb5bcdeac0636e71 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 4 Jun 2014 16:08:26 -0400 Subject: [PATCH] Check on the builds array; it may not be present if the page has changed or the builds have not yet loaded --- static/js/controllers.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/js/controllers.js b/static/js/controllers.js index 67cb99ac4..1bb907bb0 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -942,6 +942,8 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope }; $scope.handleBuildStarted = function(newBuild) { + if (!$scope.builds) { return; } + $scope.builds.unshift(newBuild); $scope.setCurrentBuild(newBuild['id'], true); }; @@ -980,6 +982,8 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope }; ApiService.requestRepoBuild(data, params).then(function(newBuild) { + if (!$scope.builds) { return; } + $scope.builds.unshift(newBuild); $scope.setCurrentBuild(newBuild['id'], true); });