diff --git a/Source/Libs/GtkSharp/CellRenderer.GetSize.cs b/Source/Libs/GtkSharp/CellRenderer.GetSize.cs index 41145e44a..d499ae5dd 100644 --- a/Source/Libs/GtkSharp/CellRenderer.GetSize.cs +++ b/Source/Libs/GtkSharp/CellRenderer.GetSize.cs @@ -127,6 +127,8 @@ namespace Gtk } var obj = TryGetObject (cell); + if (obj == default) + return; var parent = obj.NativeType; while ((parent = parent.GetBaseType ()) != GLib.GType.None) { diff --git a/Source/Libs/GtkSharp/Container.Forall.cs b/Source/Libs/GtkSharp/Container.Forall.cs index 788a0dd5f..a6ade093d 100644 --- a/Source/Libs/GtkSharp/Container.Forall.cs +++ b/Source/Libs/GtkSharp/Container.Forall.cs @@ -137,6 +137,9 @@ namespace Gtk return; var obj = TryGetObject(container); + if (obj == default) + return; + var parent = obj.NativeType; while ((parent = parent.GetBaseType()) != GLib.GType.None) { if (parent.ToString().StartsWith("__gtksharp_")) {