be more defensive in the xmlReader python bindings fixing bug #124044

* python/libxml.c: be more defensive in the xmlReader python bindings
  fixing bug #124044
Daniel
diff --git a/ChangeLog b/ChangeLog
index b6dcfd2..9f33121 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Oct 30 14:10:42 CET 2003 Daniel Veillard <daniel@veillard.com>
+
+	* python/libxml.c: be more defensive in the xmlReader python bindings
+	  fixing bug #124044
+
 Thu Oct 30 11:14:31 CET 2003 Daniel Veillard <daniel@veillard.com>
 
 	* valid.c: the a-posteriori DTD validation code was not validating
diff --git a/python/libxml.c b/python/libxml.c
index 2860bca..2ae1856 100644
--- a/python/libxml.c
+++ b/python/libxml.c
@@ -1644,9 +1644,17 @@
     xmlTextReaderErrorFunc f;
     void *arg;
 
+    if (self == NULL) {
+	Py_INCREF(Py_None);
+	return(Py_None);
+    }
     if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeTextReader", &pyobj_reader))
         return(NULL);
     reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader);
+    if (reader == NULL) {
+	Py_INCREF(Py_None);
+	return(Py_None);
+    }
 
     xmlTextReaderGetErrorHandler(reader,&f,&arg);
     if (arg != NULL) {