forked from enlightenment/efl
csharp: Raise exception when Array is null.
Reviewers: felipealmeida, vitor.sousa, segfaultxavi Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8499
This commit is contained in:
parent
b41ed254a9
commit
731db8b644
|
@ -99,6 +99,11 @@ public class Array<T> : IEnumerable<T>, IDisposable
|
||||||
|
|
||||||
public Array(IntPtr handle, bool own)
|
public Array(IntPtr handle, bool own)
|
||||||
{
|
{
|
||||||
|
if (handle == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Handle can't be null");
|
||||||
|
}
|
||||||
|
|
||||||
Handle = handle;
|
Handle = handle;
|
||||||
Own = own;
|
Own = own;
|
||||||
OwnContent = own;
|
OwnContent = own;
|
||||||
|
@ -106,6 +111,11 @@ public class Array<T> : IEnumerable<T>, IDisposable
|
||||||
|
|
||||||
public Array(IntPtr handle, bool own, bool ownContent)
|
public Array(IntPtr handle, bool own, bool ownContent)
|
||||||
{
|
{
|
||||||
|
if (handle == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Handle can't be null");
|
||||||
|
}
|
||||||
|
|
||||||
Handle = handle;
|
Handle = handle;
|
||||||
Own = own;
|
Own = own;
|
||||||
OwnContent = ownContent;
|
OwnContent = ownContent;
|
||||||
|
|
|
@ -460,6 +460,12 @@ class TestEinaArray
|
||||||
Test.Assert(a.Handle != IntPtr.Zero);
|
Test.Assert(a.Handle != IntPtr.Zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void create_array_from_null()
|
||||||
|
{
|
||||||
|
Test.AssertRaises<ArgumentNullException>(() => new Eina.Array<int>(IntPtr.Zero, false));
|
||||||
|
Test.AssertRaises<ArgumentNullException>(() => new Eina.Array<int>(IntPtr.Zero, false, false));
|
||||||
|
}
|
||||||
|
|
||||||
public static void push_int()
|
public static void push_int()
|
||||||
{
|
{
|
||||||
var a = new Eina.Array<int>();
|
var a = new Eina.Array<int>();
|
||||||
|
|
Loading…
Reference in New Issue