Browse files

Fix for export api request for campaign subscriber activity and no ac…

…tivity returned. In this case 'data.split' will fail as data is undefined.
  • Loading branch information...
1 parent 2916dff commit e53ae4b0b5cf6550d8bcfbaea4587792fae2c925 @cbrady321 cbrady321 committed Dec 19, 2012
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 e53ae4b

Please sign in to comment.