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&)'