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 b704fb74df
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -494,7 +494,7 @@ function update(appId, force, manifest, portBindings, icon, callback) {
assert.strictEqual(typeof appId, 'string');
assert.strictEqual(typeof force, 'boolean');
assert(manifest && typeof manifest === 'object');
assert(!portBindings || typeof portBindings === 'object');
assert(typeof portBindings === 'object'); // can be null
assert(!icon || typeof icon === 'string');
assert.strictEqual(typeof callback, 'function');
+1 -1
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));