Skip to content

Commit

Permalink
fix(vfs): fix VFSUriLoader crash
Browse files Browse the repository at this point in the history
  • Loading branch information
etkmao authored and wwwcg committed Sep 20, 2023
1 parent 1e22e89 commit 36b0c2e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/vfs/ios/VFSUriLoader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,15 @@
//check if convenient loader exists, or forward to cpp loader
if (cur_convenient) {
auto startPoint = footstone::TimePoint::SystemNow();
auto weak_this = weak_from_this();
VFSHandlerCompletionBlock callback = ^(NSData *data, NSURLResponse *response, NSError *error) {
auto endPoint = footstone::TimePoint::SystemNow();
string_view uri(NSStringToU16StringView([[response URL] absoluteString]));
string_view msg([error.localizedDescription UTF8String]?:"");
DoRequestResultCallback(uri, startPoint, endPoint, static_cast<int32_t>(error.code), msg);
auto shared_this = weak_this.lock();
if (shared_this) {
DoRequestResultCallback(uri, startPoint, endPoint, static_cast<int32_t>(error.code), msg);
}
if (completion) {
completion(data, response, error);
}
Expand Down

0 comments on commit 36b0c2e

Please sign in to comment.