From 9e66a083ea1f136a5264dd5182e58d04dd574778 Mon Sep 17 00:00:00 2001 From: Niraj D Date: Fri, 22 Dec 2017 22:09:42 -0500 Subject: [PATCH] Fixed loop variable being used twice --- noneroll.gs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/noneroll.gs b/noneroll.gs index 945bb6e..b496c1e 100644 --- a/noneroll.gs +++ b/noneroll.gs @@ -62,9 +62,9 @@ function getEmails() { var rex = /.*?]*href=["'](https?:\/\/[^"']+)["'][^>]*>(.*?)<\/a>.*?/gi while(u = rex.exec(threads[i].getMessages()[0].getBody())){ if(u[0].toLowerCase().indexOf('unsubscribe')!==-1){ - for(var i = u.length-1; i >=0; i--){ - if(u[i].substring(0,4)=="http"){ - d.uns=u[i] + for(var j = u.length-1; j >=0; j--){ + if(u[j].substring(0,4)=="http"){ + d.uns=u[j] break } } @@ -74,9 +74,6 @@ function getEmails() { } } } - if(d.uns === null){ - Logger.log(d.subject) - } data.push(d) } else { break