fix structured error handling problems #564217 daniel

* error.c: fix structured error handling problems #564217
daniel

svn path=/trunk/; revision=3826
diff --git a/ChangeLog b/ChangeLog
index 4c57143..effb5ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Apr  2 13:57:15 CEST 2009 Daniel Veillard <daniel@veillard.com>
+
+	* error.c: fix structured error handling problems #564217
+
 Thu Mar 26 19:08:08 CET 2009 Rob Richards <rrichards@cdatazone.org>
 
 	* parser.c: use options from current parser context when creating 
diff --git a/error.c b/error.c
index 5f03d94..9ec0286 100644
--- a/error.c
+++ b/error.c
@@ -600,12 +600,12 @@
 	    channel = ctxt->sax->error;
 	data = ctxt->userData;
     } else if (channel == NULL) {
-        if (xmlStructuredError != NULL)
+        if ((schannel == NULL) && (xmlStructuredError != NULL))
 	    schannel = xmlStructuredError;
 	else
 	    channel = xmlGenericError;
 	if (!data) {
-	data = xmlGenericErrorContext;
+            data = xmlGenericErrorContext;
     }
     }
     if (schannel != NULL) {