Fix crash where portBindings is set to undefined

This commit is contained in:
Girish Ramakrishnan
2016-04-15 21:26:18 -07:00
parent db065bd0fc
commit 5c1970b37f
2 changed files with 2 additions and 2 deletions

View File

@@ -274,7 +274,7 @@ function updateApp(req, res, next) {
debug('Update app id:%s to manifest:%j with portBindings:%j', req.params.id, data.manifest, data.portBindings);
apps.update(req.params.id, data.force || false, data.manifest, data.portBindings, data.icon, function (error) {
apps.update(req.params.id, data.force || false, data.manifest, data.portBindings || null, data.icon, function (error) {
if (error && error.reason === AppsError.NOT_FOUND) return next(new HttpError(404, 'No such app'));
if (error && error.reason === AppsError.BAD_FIELD) return next(new HttpError(400, error.message));
if (error && error.reason === AppsError.BAD_STATE) return next(new HttpError(409, error.message));