Index: gw/wap-appl.c
===================================================================
RCS file: /home/cvs/gateway/gw/wap-appl.c,v
retrieving revision 1.103
diff -u -r1.103 wap-appl.c
--- gw/wap-appl.c	22 Jan 2004 14:08:24 -0000	1.103
+++ gw/wap-appl.c	29 Jan 2004 11:12:03 -0000
@@ -823,7 +823,8 @@
 #ifdef ENABLE_COOKIES
         if (session_id != -1)
             /* DAVI if (get_cookies(url, headers, find_session_machine_by_id(session_id)) == -1) */
-            if (get_cookies(headers, find_session_machine_by_id(session_id)) == -1)
+            /* Verify that WSPMachine was found and has a cookies list */
+            if (sm != NULL && sm -> cookies != NULL && get_cookies(headers, sm) == -1)
                 error(0, "WSP: Failed to extract cookies");
 #endif
 
