summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/encoding.c b/encoding.c
index 6c49fff..e2df797 100644
--- a/encoding.c
+++ b/encoding.c
@@ -1999,9 +1999,11 @@ retry:
if (handler->output != NULL) {
ret = handler->output(&out->content[out->use], &written,
in->content, &toconv);
- xmlBufferShrink(in, toconv);
- out->use += written;
- writtentot += written;
+ if (written > 0) {
+ xmlBufferShrink(in, toconv);
+ out->use += written;
+ writtentot += written;
+ }
out->content[out->use] = 0;
}
#ifdef LIBXML_ICONV_ENABLED