Merge pull request #1420 from shenlebantongying/fix-qrcx-fail-crash

fix: a crash when qrcx:// fails.
This commit is contained in:
xiaoyifang 2024-03-19 21:47:15 +08:00 committed by GitHub
commit ebce607634
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,7 +12,12 @@ void ResourceSchemeHandler::requestStarted( QWebEngineUrlRequestJob * requestJob
const QMimeType mineType = db.mimeTypeForUrl( url );
const sptr< Dictionary::DataRequest > reply = this->mManager.getResource( url, content_type );
content_type = mineType.name();
if ( reply->isFinished() ) {
if ( reply == nullptr ) {
qDebug() << "Resource failed to load: " << url.toString();
requestJob->fail( QWebEngineUrlRequestJob::RequestFailed );
}
else if ( reply->isFinished() ) {
replyJob( reply, requestJob, content_type );
}
else