diff --git a/hgext/histedit.py b/hgext/histedit.py
index a920abf5a592038e15b6e292974938a2bf3d0d48_aGdleHQvaGlzdGVkaXQucHk=..3c762cceedde44b89ac90f44115d82de6f78393a_aGdleHQvaGlzdGVkaXQucHk= 100644
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -893,7 +893,6 @@
 
 def bootstrapcontinue(ui, state, opts):
     repo = state.repo
-    action, currentnode = state.rules.pop(0)
-
-    actobj = actiontable[action].fromrule(state, currentnode)
+    if state.rules:
+        action, currentnode = state.rules.pop(0)
 
@@ -899,6 +898,5 @@
 
-    s = repo.status()
-    if s.modified or s.added or s.removed or s.deleted:
-        actobj.continuedirty()
+        actobj = actiontable[action].fromrule(state, currentnode)
+
         s = repo.status()
         if s.modified or s.added or s.removed or s.deleted:
@@ -903,4 +901,7 @@
         s = repo.status()
         if s.modified or s.added or s.removed or s.deleted:
-            raise util.Abort(_("working copy still dirty"))
+            actobj.continuedirty()
+            s = repo.status()
+            if s.modified or s.added or s.removed or s.deleted:
+                raise util.Abort(_("working copy still dirty"))
 
@@ -906,3 +907,3 @@
 
-    parentctx, replacements = actobj.continueclean()
+        parentctx, replacements = actobj.continueclean()
 
@@ -908,6 +909,6 @@
 
-    state.parentctxnode = parentctx.node()
-    state.replacements.extend(replacements)
+        state.parentctxnode = parentctx.node()
+        state.replacements.extend(replacements)
 
     return state