This project is read-only.


Writing zero bytes to a ZipOutputStream causes exception


It would be nice if ZipOutputStream could automatically detect and handle writing zero bytes.
See the following example:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ionic.Zip;
using System.IO;
namespace ziptest
class Program
    static void Main(string[] args)
        using (var zip = new Ionic.Zip.ZipOutputStream(new MemoryStream()))
            // Both of the lines below cause the following exception
             Unhandled Exception: System.InvalidOperationException: Nullable object must have a value.
               at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
               at Ionic.Zip.ZipOutputStream._FinishCurrentEntry()
               at Ionic.Zip.ZipOutputStream.Dispose(Boolean notCalledFromFinalizer)
               at System.IO.Stream.Close()
               at ziptest.Program.Main(String[] args) in Z:\dev\Source\test\ziptest\ziptest\Program.cs:line 21
            zip.Write(null, 0, 0);
            //zip.Write(new byte[1], 0, 0);

Closed Jun 15, 2011 at 1:21 PM by Cheeso
fixed in changeset 79158. First binary that will get this change: v1.9.1.6