File tree Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change 4
4
"sources" : [ ],
5
5
"conditions" : [
6
6
['OS=="mac"' , {
7
- "xcode_settings" : {
8
- "MACOSX_DEPLOYMENT_TARGET" : "10.12"
9
- },
10
7
"sources" : [
11
8
"src/defaults.mm" ,
12
9
"src/json_formatter.h" ,
23
20
],
24
21
'defines' : [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ],
25
22
"xcode_settings" : {
26
- "OTHER_CPLUSPLUSFLAGS" : ["-std=c++14" , "-stdlib=libc++" ],
27
- "OTHER_LDFLAGS" : ["-framework CoreFoundation -framework Cocoa -framework Carbon" ]
23
+ "OTHER_CPLUSPLUSFLAGS" : ["-std=c++17" , "-stdlib=libc++" , "-Wextra" ],
24
+ "OTHER_LDFLAGS" : ["-framework CoreFoundation -framework Cocoa -framework Carbon" ],
25
+ "MACOSX_DEPLOYMENT_TARGET" : "10.12"
28
26
}
29
27
}]
30
28
}
Original file line number Diff line number Diff line change 84
84
[mutable_array addObject: ToNSString (str)];
85
85
} else if (val.IsArray ()) {
86
86
Napi::Array sub_array = val.As <Napi::Array>();
87
- [mutable_array addObject: NapiArrayToNSArray (sub_array)];
87
+ if (NSArray *ns_arr = NapiArrayToNSArray (sub_array)) {
88
+ [mutable_array addObject: ns_arr];
89
+ }
88
90
} else if (val.IsObject ()) {
89
- NSDictionary *dict = NapiObjectToNSDictionary (val);
90
- [mutable_array addObject: dict];
91
+ if (NSDictionary *dict = NapiObjectToNSDictionary (val)) {
92
+ [mutable_array addObject: dict];
93
+ }
91
94
}
92
95
}
93
96
@@ -207,10 +210,14 @@ void SetUserDefault(const Napi::CallbackInfo &info) {
207
210
[defaults setURL: url forKey: default_key];
208
211
} else if (type == " array" ) {
209
212
Napi::Array array = info[2 ].As <Napi::Array>();
210
- [defaults setObject: NapiArrayToNSArray (array) forKey: default_key];
213
+ if (NSArray *ns_arr = NapiArrayToNSArray (array)) {
214
+ [defaults setObject: ns_arr forKey: default_key];
215
+ }
211
216
} else if (type == " dictionary" ) {
212
217
Napi::Value value = info[2 ].As <Napi::Value>();
213
- [defaults setObject: NapiObjectToNSDictionary (value) forKey: default_key];
218
+ if (NSDictionary * dict = NapiObjectToNSDictionary (value)) {
219
+ [defaults setObject: dict forKey: default_key];
220
+ }
214
221
}
215
222
}
216
223
You can’t perform that action at this time.
0 commit comments