From cc1b67575c7c7afc54706be393dc321e0c1d492b Mon Sep 17 00:00:00 2001 From: Roman Usachev Date: Wed, 24 Feb 2016 05:34:53 +0300 Subject: [PATCH] Null vars fix --- app/components/container/containerController.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/components/container/containerController.js b/app/components/container/containerController.js index 56881de7a..7ef89ab9c 100644 --- a/app/components/container/containerController.js +++ b/app/components/container/containerController.js @@ -1,4 +1,4 @@ -angular.module('container', []) + angular.module('container', []) .controller('ContainerController', ['$scope', '$routeParams', '$location', 'Container', 'ContainerCommit', 'Image', 'Messages', 'ViewSpinner', '$timeout', function ($scope, $routeParams, $location, Container, ContainerCommit, Image, Messages, ViewSpinner, $timeout) { $scope.changes = []; @@ -18,16 +18,20 @@ angular.module('container', []) $scope.container.newContainerName = d.Name; // fill up env - $scope.newCfg.Env = d.Config.Env.map(function(entry) { - return {name: entry.split('=')[0], value: entry.split('=')[1]}; - }); + if (d.Config.Env) { + $scope.newCfg.Env = d.Config.Env.map(function (entry) { + return {name: entry.split('=')[0], value: entry.split('=')[1]}; + }); + } // fill up ports $scope.newCfg.Ports = {}; angular.forEach(d.Config.ExposedPorts, function(i, port) { - $scope.newCfg.Ports[port] = d.HostConfig.PortBindings[port] || []; + if (d.HostConfig.PortBindings && port in d.HostConfig.PortBindings) + $scope.newCfg.Ports[port] = d.HostConfig.PortBindings[port]; + else + $scope.newCfg.Ports[port] = []; }); - //angular.forEach($scope.newCfg.Ports, function(conf, port, arr) { arr[port] = conf || []; }); // fill up bindings $scope.newCfg.Binds = [];