summaryrefslogtreecommitdiff
path: root/src/saxparser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/saxparser.cc')
-rw-r--r--src/saxparser.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/saxparser.cc b/src/saxparser.cc
index 19c6142..1090ef3 100644
--- a/src/saxparser.cc
+++ b/src/saxparser.cc
@@ -25,6 +25,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#include "saxparser.h"
+
+#include <stdio.h>
#include <string.h>
static void character_hndl(void *p, const XML_Char *s, int len)
@@ -90,8 +92,13 @@ int SAXParser::parse()
do {
len = readData(buf, sizeof(buf) - 1);
- if (! XML_Parse(p, buf, len, len == 0)) {
- parseError(buf, len, XML_ErrorString(XML_GetErrorCode(p)), (int)XML_GetCurrentLineNumber(p));
+ if(len == -1) {
+ parseError((char*)"", 0, "Could not read data", 0);
+ return 1;
+ }
+ if(!XML_Parse(p, buf, len, len == 0)) {
+ parseError(buf, len, XML_ErrorString(XML_GetErrorCode(p)),
+ (int)XML_GetCurrentLineNumber(p));
return 1;
}