File tree Expand file tree Collapse file tree
source/Firebase/Analytics Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,16 +125,23 @@ public static class UserPropertyNamesConstants
125125 public partial class Analytics {
126126 public static void SetConsent ( Dictionary < ConsentType , ConsentStatus > consentSettings )
127127 {
128+ if ( consentSettings == null )
129+ throw new ArgumentNullException ( nameof ( consentSettings ) ) ;
130+
128131 var keys = new List < NSString > ( ) ;
129132 var values = new List < NSString > ( ) ;
130133
131134 foreach ( var kv in consentSettings ) {
132- keys . Add ( global ::Firebase . Analytics . ConsentTypeExtensions . GetConstant ( kv . Key ) ) ;
133- values . Add ( global ::Firebase . Analytics . ConsentStatusExtensions . GetConstant ( kv . Value ) ) ;
135+ var key = global ::Firebase . Analytics . ConsentTypeExtensions . GetConstant ( kv . Key )
136+ ?? throw new ArgumentOutOfRangeException ( nameof ( consentSettings ) , kv . Key , "Unknown consent type." ) ;
137+ var value = global ::Firebase . Analytics . ConsentStatusExtensions . GetConstant ( kv . Value )
138+ ?? throw new ArgumentOutOfRangeException ( nameof ( consentSettings ) , kv . Value , "Unknown consent status." ) ;
139+
140+ keys . Add ( key ) ;
141+ values . Add ( value ) ;
134142 }
135143
136144 _SetConsent ( new NSDictionary < NSString , NSString > ( keys . ToArray ( ) , values . ToArray ( ) ) ) ;
137145 }
138146 }
139147}
140-
You can’t perform that action at this time.
0 commit comments