generator: null check for handle (NativeStructGen)
Check Handle against IntPtr.Zero before marshalling.
This commit is contained in:
parent
29a900e51e
commit
33fd293b84
1 changed files with 2 additions and 1 deletions
|
@ -126,7 +126,8 @@ namespace GtkSharp.Generation
|
|||
|
||||
sw.WriteLine ("\t\tprivate void Update ()", QualifiedName);
|
||||
sw.WriteLine ("\t\t{");
|
||||
sw.WriteLine ("\t\t\tthis.managed_struct = ({0})Marshal.PtrToStructure (this.Handle, typeof({0}));", native_struct_name);
|
||||
sw.WriteLine ("\t\t\tif (Handle != IntPtr.Zero)");
|
||||
sw.WriteLine ("\t\t\t\tthis.managed_struct = ({0})Marshal.PtrToStructure (this.Handle, typeof ({0}));", native_struct_name);
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue