Skip to content

Commit ef2f330

Browse files
authored
Add a nil check to Avatar image property (#650)
* Add a nil check to AvatarData image * Change files
1 parent 41364a1 commit ef2f330

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

apps/ios/src/Podfile.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ PODS:
99
- React-Core (= 0.63.4)
1010
- React-jsi (= 0.63.4)
1111
- ReactCommon/turbomodule/core (= 0.63.4)
12-
- FluentUI-React-Native-Apple-Theme (0.4.1):
12+
- FluentUI-React-Native-Apple-Theme (0.4.2):
1313
- MicrosoftFluentUI (~> 0.2.2)
1414
- React
15-
- FluentUI-React-Native-Avatar (0.6.2):
15+
- FluentUI-React-Native-Avatar (0.6.3):
1616
- MicrosoftFluentUI (~> 0.2.2)
1717
- React
18-
- FluentUI-React-Native-Button (0.5.2):
18+
- FluentUI-React-Native-Button (0.5.3):
1919
- MicrosoftFluentUI (~> 0.2.2)
2020
- React
21-
- FluentUI-React-Native-Shimmer (0.6.2):
21+
- FluentUI-React-Native-Shimmer (0.6.3):
2222
- MicrosoftFluentUI (~> 0.2.2)
2323
- React
2424
- Folly (2020.01.13.00):
@@ -442,15 +442,15 @@ EXTERNAL SOURCES:
442442

443443
SPEC CHECKSUMS:
444444
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
445-
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
445+
DoubleConversion: cde416483dac037923206447da6e1454df403714
446446
FBLazyVector: 3bb422f41b18121b71783a905c10e58606f7dc3e
447447
FBReactNativeSpec: f2c97f2529dd79c083355182cc158c9f98f4bd6e
448-
FluentUI-React-Native-Apple-Theme: 8cb97ccc0072dff5436884ea8838da0f772186b4
449-
FluentUI-React-Native-Avatar: 0ff639466867066a1f2ba1074e166b0190402f20
450-
FluentUI-React-Native-Button: 67a38324ca749cffba64a015d7d2a9f3e02e3cc8
451-
FluentUI-React-Native-Shimmer: 0e4b1415c1d13eda2310c2b43c570eccbf5b7e93
448+
FluentUI-React-Native-Apple-Theme: 5096ba1ccdce75cac6af8dfb6f43880828d6a8e1
449+
FluentUI-React-Native-Avatar: 1a463d15fe9cef99c18dcec0516ebd5459fe2e25
450+
FluentUI-React-Native-Button: b882911504fd4b8ad21b6391b6fb49d908276f5e
451+
FluentUI-React-Native-Shimmer: 73e604318cff67e942b04ac6b7f3908ce4fa6b38
452452
Folly: b73c3869541e86821df3c387eb0af5f65addfab4
453-
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
453+
glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
454454
MicrosoftFluentUI: 8a1ef14a8479106c33822d05b774e04051bb33f2
455455
QRCodeReader.swift: 373a389fe9a22d513c879a32a6f647c58f4ef572
456456
RCTRequired: 082f10cd3f905d6c124597fd1c14f6f2655ff65e
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"type": "patch",
3+
"comment": "Add an NSNull check to the image property",
4+
"packageName": "@fluentui-react-native/experimental-avatar",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch",
7+
"date": "2021-03-30T19:26:33.490Z"
8+
}

packages/experimental/Avatar/ios/MSFAvatarViewManager.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ @implementation RCTConvert (MSFAvatarViewAdditions)
4040

4141
+ (MSFAvatarData *)MSFAvatarData:(id)json
4242
{
43+
// [RCTConvert UIImage:] throws an error if we pass it a nil value, so do an extra check
44+
UIImage *image = (![json[@"image"] isEqual:[NSNull null]]) ? [RCTConvert UIImage:json[@"image"]] : nil;
45+
4346
return [[MSFAvatarData alloc]initWithPrimaryText:[RCTConvert NSString:json[@"primaryText"]]
4447
secondaryText:[RCTConvert NSString:json[@"secondaryText"]]
45-
image:[RCTConvert UIImage:json[@"image"]]
48+
image:image
4649
presence:[RCTConvert MSFPresence:json[@"presence"]]
4750
color:[RCTConvert UIColor:json[@"color"]]];
4851
}

0 commit comments

Comments
 (0)