fix: a crash when qrcx:// fails.

The reply here might be nullptr.
This commit is contained in:
shenleban tongying 2024-03-19 03:18:21 -04:00
parent dd95690940
commit d546cafda4
No known key found for this signature in database

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