Skip to content
Browse files

Merge pull request #19 from toastmeister/master

Return an empty array when API returns no subscriber activitiy
  • Loading branch information...
2 parents 2916dff + e53ae4b commit d4507a268e9465f70796f6ba25f78e14d7c03098 @gomfunkel committed
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/mailchimp/MailChimpExportAPI_v1_0.js
View
8 lib/mailchimp/MailChimpExportAPI_v1_0.js
@@ -137,7 +137,13 @@ MailChimpExportAPI_v1_0.prototype.campaignSubscriberActivity = function (params,
* it to the callback function.
*/
MailChimpExportAPI_v1_0.prototype.campaignSubscriberActivityProcess = function (data, callback) {
-
+
+ // when api returns empty set data variable is undefined
+ if(typeof data === 'undefined'){
+ callback(null, []);
+ return;
+ }
+
var resultStrings = data.split("\n");
var resultJSON = [];

0 comments on commit d4507a2

Please sign in to comment.
Something went wrong with that request. Please try again.