File tree Expand file tree Collapse file tree
libs/SalesforceSDKCommon/SalesforceSDKCommon/Classes/Util Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 */
2424
2525#import " SFSDKSafeMutableDictionary.h"
26+ #import " SFLogger.h"
2627
2728@interface SFSDKSafeMutableDictionary ()
2829
@@ -89,6 +90,10 @@ - (NSDictionary *)dictionary {
8990#pragma Mark - Mutating Methods
9091
9192- (void )setObject : (id )object forKey : (id <NSCopying >)aKey {
93+ if (aKey == nil ) {
94+ [SFLogger w: [self class ] format: @" Attempted to set object with nil key in safe dictionary" ];
95+ return ;
96+ }
9297 dispatch_barrier_async (self.queue , ^{
9398 self.backingDictionary [aKey] = object;
9499 });
@@ -99,6 +104,10 @@ - (void)setObject:(id)object forKeyedSubscript:(id<NSCopying>)aKey {
99104}
100105
101106- (void )removeObject : (id <NSCopying >)aKey {
107+ if (aKey == nil ) {
108+ [SFLogger w: [self class ] format: @" Attempted to remove nil key from safe dictionary" ];
109+ return ;
110+ }
102111 dispatch_barrier_async (self.queue , ^{
103112 [self .backingDictionary removeObjectForKey: aKey];
104113 });
You can’t perform that action at this time.
0 commit comments