@@ -8,7 +8,7 @@ namespace Firebase.CloudFirestore
88{
99 class CloudFirestoreHelper
1010 {
11- public static NSObject [ ] GetNSObjects ( object [ ] objects )
11+ public static NSObject [ ] ? GetNSObjects ( object [ ] ? objects )
1212 {
1313 if ( objects == null )
1414 return null ;
@@ -25,21 +25,21 @@ public static NSObject [] GetNSObjects (object [] objects)
2525 public partial class Firestore
2626 {
2727 // id _Nullable (^ _Nonnull)(FIRTransaction * _Nonnull, NSError * _Nullable * _Nullable)
28- public delegate NSObject TransactionUpdateHandler ( Transaction transaction , ref NSError error ) ;
28+ public delegate NSObject ? TransactionUpdateHandler ( Transaction transaction , ref NSError ? error ) ;
2929
3030 public void RunTransaction ( TransactionUpdateHandler updateHandler , TransactionCompletionHandler completion )
3131 {
32+ if ( updateHandler == null )
33+ throw new ArgumentNullException ( nameof ( updateHandler ) ) ;
34+
3235 _RunTransaction ( InternalUpdateHandler , completion ) ;
3336
34- NSObject InternalUpdateHandler ( Transaction transaction , IntPtr pError )
37+ NSObject ? InternalUpdateHandler ( Transaction transaction , IntPtr pError )
3538 {
36- if ( updateHandler == null )
37- return null ;
38-
39- NSError error = null ;
39+ NSError ? error = null ;
4040 var result = updateHandler ( transaction , ref error ) ;
4141
42- if ( error != null )
42+ if ( pError != IntPtr . Zero && error != null )
4343 Marshal . WriteIntPtr ( pError , error . Handle ) ;
4444
4545 return result ;
@@ -48,26 +48,26 @@ NSObject InternalUpdateHandler (Transaction transaction, IntPtr pError)
4848
4949 public void RunTransaction ( TransactionOptions options , TransactionUpdateHandler updateHandler , TransactionCompletionHandler completion )
5050 {
51+ if ( updateHandler == null )
52+ throw new ArgumentNullException ( nameof ( updateHandler ) ) ;
53+
5154 _RunTransaction ( options , InternalUpdateHandler , completion ) ;
5255
53- NSObject InternalUpdateHandler ( Transaction transaction , IntPtr pError )
56+ NSObject ? InternalUpdateHandler ( Transaction transaction , IntPtr pError )
5457 {
55- if ( updateHandler == null )
56- return null ;
57-
58- NSError error = null ;
58+ NSError ? error = null ;
5959 var result = updateHandler ( transaction , ref error ) ;
6060
61- if ( error != null )
61+ if ( pError != IntPtr . Zero && error != null )
6262 Marshal . WriteIntPtr ( pError , error . Handle ) ;
6363
6464 return result ;
6565 }
6666 }
6767
68- public Task < NSObject > RunTransactionAsync ( TransactionUpdateHandler updateHandler )
68+ public Task < NSObject ? > RunTransactionAsync ( TransactionUpdateHandler updateHandler )
6969 {
70- var tcs = new TaskCompletionSource < NSObject > ( ) ;
70+ var tcs = new TaskCompletionSource < NSObject ? > ( ) ;
7171 RunTransaction ( updateHandler , ( result_ , error_ ) => {
7272 if ( error_ != null )
7373 tcs . SetException ( new NSErrorException ( error_ ) ) ;
@@ -77,9 +77,9 @@ public Task<NSObject> RunTransactionAsync (TransactionUpdateHandler updateHandle
7777 return tcs . Task ;
7878 }
7979
80- public Task < NSObject > RunTransactionAsync ( TransactionOptions options , TransactionUpdateHandler updateHandler )
80+ public Task < NSObject ? > RunTransactionAsync ( TransactionOptions options , TransactionUpdateHandler updateHandler )
8181 {
82- var tcs = new TaskCompletionSource < NSObject > ( ) ;
82+ var tcs = new TaskCompletionSource < NSObject ? > ( ) ;
8383 RunTransaction ( options , updateHandler , ( result_ , error_ ) => {
8484 if ( error_ != null )
8585 tcs . SetException ( new NSErrorException ( error_ ) ) ;
0 commit comments