From edeeddb02085b282da7a40993ed4ad908f9912d1 Mon Sep 17 00:00:00 2001 From: Henrik Bengtsson Date: Mon, 28 Dec 2020 10:32:00 -0800 Subject: [PATCH] BUG FIX: setDoSeq() removes the wrong variables if there's an error (fixes #25) --- R/setDoSeq.R | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/R/setDoSeq.R b/R/setDoSeq.R index 3052a77..6dc8e9e 100644 --- a/R/setDoSeq.R +++ b/R/setDoSeq.R @@ -35,12 +35,12 @@ setDoSeq <- function(fun, data=NULL, info=function(data, item) NULL) { assign('seqData', data, pos=.foreachGlobals, inherits=FALSE) assign('seqInfo', info, pos=.foreachGlobals, inherits=FALSE) }, error = function(e) { - if (exists('fun', where=.foreachGlobals, inherits=FALSE)) - remove('fun', envir = .foreachGlobals) - if (exists('data', where=.foreachGlobals, inherits=FALSE)) - remove('data', envir = .foreachGlobals) - if (exists('info', where=.foreachGlobals, inherits=FALSE)) - remove('info', envir = .foreachGlobals) + if (exists('seqFun', where=.foreachGlobals, inherits=FALSE)) + remove('seqFun', envir = .foreachGlobals) + if (exists('seqData', where=.foreachGlobals, inherits=FALSE)) + remove('seqData', envir = .foreachGlobals) + if (exists('seqInfo', where=.foreachGlobals, inherits=FALSE)) + remove('seqInfo', envir = .foreachGlobals) e }) }