C# System.NullReferenceException
<p>For some reason this gives me a "System.NullReferenceException: Object reference not set to an instance of an object" error. What could cause this?</p>

<pre><code>public class Font
{
    private PrivateFontCollection MyFonts = new PrivateFontCollection();
    public  Font()
    {
        string resource = "zig_____";
        Stream fontStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource);
        System.IntPtr data = Marshal.AllocCoTaskMem((int)fontStream.Length);//this is the line that causes the error
        byte[] fontdata = new byte[fontStream.Length];
        fontStream.Read(fontdata, 0, (int)fontStream.Length);
        Marshal.Copy(fontdata, 0, data, (int)fontStream.Length);
        MyFonts.AddMemoryFont(data, (int)fontStream.Length);
        fontStream.Close();
        Marshal.FreeCoTaskMem(data);
    }   
}
</code></pre>
