Skip to content

Avoid possible null pointer dereference in WebEnginePartDownloadManager::blobDownloadedToFile()

In the 'else' block, the 'page' pointer must be null because a non-null pointer is handled in the 'if' part. If this block were to be executed, there would be a null dereference through the pointer. GCC detects this with:

webenginepart/src/webenginepartdownloadmanager.cpp: In member function 'void WebEnginePartDownloadManager::blobDownloadedToFile(QWebEngineDownloadItem*, WebEnginePage*)': webenginepart/src/webenginepartdownloadmanager.cpp:177: warning: 'this' pointer is null /usr/include/qt5/QtWebEngineWidgets/qwebenginepage.h:244: note: in a call to non-static member function 'QWidget* QWebEnginePage::view() const'

Since 'w' can never be a valid widget, the solution is simply to pass nullptr to the JobUiIDelegate.

Merge request reports