From 01cd0cbc5a30be8534d9240992db613233e6b420 Mon Sep 17 00:00:00 2001 From: Pagan Gazzard Date: Thu, 3 Nov 2016 19:36:12 +0000 Subject: [PATCH] Fix an error when trying to call logSystemEvent with an undefined app --- src/application.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/application.coffee b/src/application.coffee index 0026cd03..ac468366 100644 --- a/src/application.coffee +++ b/src/application.coffee @@ -114,7 +114,7 @@ application.logSystemMessage = logSystemMessage = (message, obj, eventName) -> logger.log({ m: message, s: 1 }) utils.mixpanelTrack(eventName ? message, obj) -logSystemEvent = (logType, app, error) -> +logSystemEvent = (logType, app = {}, error) -> message = "#{logType.humanName} '#{app.imageId}'" if error? # Report the message from the original cause to the user. @@ -640,7 +640,8 @@ application.update = update = (force, scheduled = false) -> Promise.try -> needsDownload = _.includes(toBeDownloaded, appId) if _.includes(toBeRemoved, appId) - Promise.using lockUpdates(localApps[appId], force), -> + app = localApps[appId] + Promise.using lockUpdates(app, force), -> # We get the app from the DB again in case someone restarted it # (which would have changed its containerId) utils.getKnexApp(appId)