diff --git a/src/bindings/mono/eina_mono/eina_array.cs b/src/bindings/mono/eina_mono/eina_array.cs index f4dd49d69e..b2cdede565 100644 --- a/src/bindings/mono/eina_mono/eina_array.cs +++ b/src/bindings/mono/eina_mono/eina_array.cs @@ -99,6 +99,11 @@ public class Array : IEnumerable, IDisposable public Array(IntPtr handle, bool own) { + if (handle == IntPtr.Zero) + { + throw new ArgumentNullException("Handle can't be null"); + } + Handle = handle; Own = own; OwnContent = own; @@ -106,6 +111,11 @@ public class Array : IEnumerable, IDisposable public Array(IntPtr handle, bool own, bool ownContent) { + if (handle == IntPtr.Zero) + { + throw new ArgumentNullException("Handle can't be null"); + } + Handle = handle; Own = own; OwnContent = ownContent; diff --git a/src/tests/efl_mono/Eina.cs b/src/tests/efl_mono/Eina.cs index 8b7f1a9672..6a07e2f288 100644 --- a/src/tests/efl_mono/Eina.cs +++ b/src/tests/efl_mono/Eina.cs @@ -460,6 +460,12 @@ class TestEinaArray Test.Assert(a.Handle != IntPtr.Zero); } + public static void create_array_from_null() + { + Test.AssertRaises(() => new Eina.Array(IntPtr.Zero, false)); + Test.AssertRaises(() => new Eina.Array(IntPtr.Zero, false, false)); + } + public static void push_int() { var a = new Eina.Array();