* throw.c (scm_ithrow): Use the correct variable when checking to
authorJim Blandy <jimb@red-bean.com>
Thu, 3 Oct 1996 05:28:52 +0000 (05:28 +0000)
committerJim Blandy <jimb@red-bean.com>
Thu, 3 Oct 1996 05:28:52 +0000 (05:28 +0000)
see if a given element of scm_dynwinds is a valid catch.

* throw.c (scm_ithrow): If scm_dynwinds has invalid list
structure, abort; don't just silently ignore the garbage.

libguile/throw.c

index 65452b2..0345c1d 100644 (file)
@@ -252,12 +252,13 @@ scm_ithrow (key, args, noreturn)
 
       /* Search the wind list for an appropriate catch.
         "Waiter, please bring us the wind list." */
-      for (winds = scm_dynwinds;
-          SCM_NIMP (winds) && SCM_CONSP (winds);
-          winds = SCM_CDR (winds))
+      for (winds = scm_dynwinds; SCM_NIMP (winds); winds = SCM_CDR (winds))
        {
+         if (! SCM_CONSP (winds))
+           abort ();
+
          dynpair = SCM_CAR (winds);
-         if (SCM_NIMP (winds) && SCM_CONSP (winds))
+         if (SCM_NIMP (dynpair) && SCM_CONSP (dynpair))
            {
              SCM this_key = SCM_CAR (dynpair);
 
@@ -267,8 +268,11 @@ scm_ithrow (key, args, noreturn)
        }
 
       /* If we didn't find anything, print a message and exit Guile.  */
-      if (SCM_IMP (winds) || SCM_NCONSP (winds))
+      if (winds == SCM_EOL)
        uncaught_throw (key, args);
+
+      if (SCM_IMP (winds) || SCM_NCONSP (winds))
+       abort ();
       
       if (dynpair != SCM_BOOL_F)
        jmpbuf = SCM_CDR (dynpair);