mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
fix: a crash when qrcx:// fails.
The reply here might be nullptr.
This commit is contained in:
parent
dd95690940
commit
d546cafda4
|
@ -12,7 +12,12 @@ void ResourceSchemeHandler::requestStarted( QWebEngineUrlRequestJob * requestJob
|
||||||
const QMimeType mineType = db.mimeTypeForUrl( url );
|
const QMimeType mineType = db.mimeTypeForUrl( url );
|
||||||
const sptr< Dictionary::DataRequest > reply = this->mManager.getResource( url, content_type );
|
const sptr< Dictionary::DataRequest > reply = this->mManager.getResource( url, content_type );
|
||||||
content_type = mineType.name();
|
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 );
|
replyJob( reply, requestJob, content_type );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue