Skip to content

Commit d440418

Browse files
authored
Fix SIGSEGV in callback after block is nil'd (#3786)
1 parent dfa4113 commit d440418

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Firebase/Storage/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 3.4.1
2+
- [fixed] Fix crash in FIRStorageUploadTask (#3750).
3+
14
# 3.4.0
25
- [fixed] Ensure that users don't accidently invoke `Storage()` instead of `Storage.storage()`.
36
If your code calls the constructor of Storage directly, we will throw an assertion failure,

Firebase/Storage/FIRStorageUploadTask.m

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ - (void)enqueue {
141141
// Process fetches
142142
strongSelf.state = FIRStorageTaskStateRunning;
143143

144-
#pragma clang diagnostic push
145-
#pragma clang diagnostic ignored "-Warc-retain-cycles"
146144
strongSelf->_fetcherCompletion = ^(NSData *_Nullable data, NSError *_Nullable error) {
147145
// Fire last progress updates
148146
[self fireHandlersForStatus:FIRStorageTaskStatusProgress snapshot:self.snapshot];
@@ -172,11 +170,12 @@ - (void)enqueue {
172170

173171
[self finishTaskWithStatus:FIRStorageTaskStatusSuccess snapshot:self.snapshot];
174172
};
175-
#pragma clang diagnostic pop
176173

177174
[strongSelf->_uploadFetcher
178175
beginFetchWithCompletionHandler:^(NSData *_Nullable data, NSError *_Nullable error) {
179-
weakSelf.fetcherCompletion(data, error);
176+
if (weakSelf.fetcherCompletion != nil) {
177+
weakSelf.fetcherCompletion(data, error);
178+
}
180179
}];
181180
}];
182181
}

0 commit comments

Comments
 (0)