Skip to content

Commit b60ee77

Browse files
authored
[Foundation] NSArray<T>.FromNSObjects will never return null objects. Fixes #19622. (#19627)
NSArray<T>.FromNSObjects will never return a null object, because NSArray.FromObjects won't (according to Apple's headers). Fixes #19622.
1 parent 0a4e51c commit b60ee77

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Foundation/NSArray_1.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ internal NSArray (NativeHandle handle) : base (handle)
4848
{
4949
}
5050

51-
static public NSArray<TKey>? FromNSObjects (params TKey [] items)
51+
static public NSArray<TKey> FromNSObjects (params TKey [] items)
5252
{
5353
if (items is null)
5454
throw new ArgumentNullException (nameof (items));
5555

5656
return FromNSObjects (items.Length, items);
5757
}
5858

59-
static public NSArray<TKey>? FromNSObjects (int count, params TKey [] items)
59+
static public NSArray<TKey> FromNSObjects (int count, params TKey [] items)
6060
{
6161
if (items is null)
6262
throw new ArgumentNullException (nameof (items));
@@ -71,7 +71,7 @@ internal NSArray (NativeHandle handle) : base (handle)
7171
Marshal.WriteIntPtr (buf, (int) (i * IntPtr.Size), h);
7272
}
7373
IntPtr ret = NSArray.FromObjects (buf, count);
74-
var arr = Runtime.GetNSObject<NSArray<TKey>> (ret);
74+
var arr = Runtime.GetNSObject<NSArray<TKey>> (ret)!;
7575
Marshal.FreeHGlobal (buf);
7676
return arr;
7777
}

0 commit comments

Comments
 (0)