From 3e352d42247c684712d69f72d16039481b6dbaba Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Mon, 7 Mar 2016 10:19:36 -0400 Subject: [PATCH] Avoid analytics and logging if dialog resolves no file This will be the case when the dialog accepts zip files. If the selected zip image is invalid, the module will display an error and resolve `undefined`. --- lib/browser/app.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/browser/app.js b/lib/browser/app.js index 897345c2..6e9cef30 100644 --- a/lib/browser/app.js +++ b/lib/browser/app.js @@ -128,6 +128,13 @@ app.controller('AppController', function( this.selectImage = function() { return $q.when(dialog.selectImage()).then(function(image) { + + // Avoid analytics and selection state changes + // if no file was resolved from the dialog. + if (!image) { + return; + } + self.selection.setImage(image); AnalyticsService.logEvent('Select image', { image: image