Skip to content
Commit 6476008b authored by Jonathan Marten's avatar Jonathan Marten Committed by Albert Astals Cid
Browse files

PartLoader::createPartInstanceForMimeType(): Avoid compiler detected null pointer access

Seen when compiling Konqueror.  The 'error' parameter to this template
function can be null either explicitly or by using the default value,
but if the part instantiation fails then the pointer is used unguarded.
Detected by GCC 12.2.0:

In file included from konqueror/settings/konqhtml/css/kcmcss.cpp:18:
In function 'T* KParts::PartLoader::createPartInstanceForMimeType(const QString&,
  QWidget*, QObject*, QString*) [with T = KParts::ReadOnlyPart]',
inlined from  'CSSCustomDialog::CSSCustomDialog(QWidget*)'
  at konqueror/settings/konqhtml/css/kcmcss.cpp:312:
/usr/include/KF5/KParts/kparts/partloader.h:207: warning: 'this' pointer is null
/usr/include/qt5/QtCore/qstring.h:271: note: in a call to non-static member
  function 'QString& QString::operator=(const QString&)'

(cherry picked from commit e7a4636d)
parent a428daea
Pipeline #404629 passed with stage
in 4 minutes and 39 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment