fixed the streaming property of the reader, it was generating tree faster

* xmlreader.c: fixed the streaming property of the reader,
  it was generating tree faster than consuming it. Pointed out
  by Nate Myers
* tree.c: fixed a bug in xmlSaveFormatFileEnc if passed a NULL doc
Daniel
diff --git a/tree.c b/tree.c
index bae197a..4e3f749 100644
--- a/tree.c
+++ b/tree.c
@@ -7582,6 +7582,9 @@
     xmlCharEncoding enc;
     int ret;
 
+    if (cur == NULL)
+	return(-1);
+
     if (encoding == NULL)
 	encoding = (const char *) cur->encoding;