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`.
This commit is contained in:
Juan Cruz Viotti 2016-03-07 10:19:36 -04:00
parent e5ddb2f2cb
commit 3e352d4224

View File

@ -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