longzu / csexwb2

Automatically exported from code.google.com/p/csexwb2
0 stars 0 forks source link

System.ArgumentNullException in GetActiveDocument #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,
this bug occurs randomly and is not directly reproducable. I had it first 
in 1.0.0.3 and fixed it right in your code, but than forgot to report it.

Know, as i'm switching to 1.0.0.5 the bug occured again and remembers me 
to fix it and report it here.

That's where it is:
In cEXWB.cs, line 2373 and 2375:

elem = doc2.activeElement;
IntPtr pelem = Marshal.GetIUnknownForObject(elem);

When elem is null (and sometimes it is) a System.ArgumentNullException is 
fired for line 2375 (parameter o mustn't be null).

That's how I fixed it:
Replace line 2373 to 2375 with this three lines

elem = doc2.activeElement;
IntPtr pelem = IntPtr.Zero;
if (elem != null) pelem = Marshal.GetIUnknownForObject(elem);

May be you'll find a better fix, but that's doing it for me for now.

dartrax

Original issue reported on code.google.com by dart...@gmail.com on 31 Aug 2007 at 12:51

GoogleCodeExporter commented 8 years ago
Thank you for reporting this bug. Will include a fix in the nex release.

Original comment by mehr...@gmail.com on 31 Aug 2007 at 10:18

GoogleCodeExporter commented 8 years ago
I'm glad that I could help developing the control.

dartrax

Original comment by dart...@gmail.com on 31 Aug 2007 at 10:33

GoogleCodeExporter commented 8 years ago
This issue has been resolved in v1.0.0.6

MH

Original comment by mehr...@gmail.com on 12 Oct 2007 at 2:17