avoid a regexp crash, should fix #523738 Daniel

* xmlregexp.c: avoid a regexp crash, should fix #523738
Daniel

svn path=/trunk/; revision=3744
diff --git a/ChangeLog b/ChangeLog
index 74958b9..74e4a40 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon May 12 15:12:44 CEST 2008 Daniel Veillard <daniel@veillard.com>
+
+	* xmlregexp.c: avoid a regexp crash, should fix #523738
+
 Mon May 12 14:56:06 CEST 2008 Daniel Veillard <daniel@veillard.com>
 
 	* xmlschemas.c runtest.c testapi.c include/libxml/xmlreader.h
diff --git a/xmlregexp.c b/xmlregexp.c
index 389453b..54eb957 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -3162,7 +3162,8 @@
 	exec->counts = NULL;
     while ((exec->status == 0) &&
 	   ((exec->inputString[exec->index] != 0) ||
-	    (exec->state->type != XML_REGEXP_FINAL_STATE))) {
+	    ((exec->state != NULL) &&
+	     (exec->state->type != XML_REGEXP_FINAL_STATE)))) {
 	xmlRegTransPtr trans;
 	xmlRegAtomPtr atom;