From ae7d9dfbf9fbe5165fe95d15573f55a941e0142c Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Wed, 9 Mar 2005 17:01:35 +0000 Subject: [PATCH] 2005-03-09 Mike Kestner * glib/Marshaller.cs : add IntPtr.Zero guarding. svn path=/trunk/gtk-sharp/; revision=41607 --- ChangeLog | 4 ++++ glib/Marshaller.cs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index b6ccd9193..e428e3d68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-03-09 Mike Kestner + + * glib/Marshaller.cs : add IntPtr.Zero guarding. + 2005-03-09 Alexandre Gomes * gtk/Gtk.metadata: Set GetVisibleRect param to be passed as out. diff --git a/glib/Marshaller.cs b/glib/Marshaller.cs index 73db9ea8d..45fa0f19d 100644 --- a/glib/Marshaller.cs +++ b/glib/Marshaller.cs @@ -42,6 +42,9 @@ namespace GLib { public static string Utf8PtrToString (IntPtr ptr) { + if (ptr == IntPtr.Zero) + return null; + int len = (int) g_utf8_strlen (ptr, -1); byte[] bytes = new byte [len]; Marshal.Copy (ptr, bytes, 0, len);