diff --git a/python/core/auto_generated/qgsmaplayer.sip.in b/python/core/auto_generated/qgsmaplayer.sip.in index 480915b632e..2b93bf2492b 100644 --- a/python/core/auto_generated/qgsmaplayer.sip.in +++ b/python/core/auto_generated/qgsmaplayer.sip.in @@ -1419,7 +1419,7 @@ Sets the coordinate transform context to ``transformContext`` SIP_PYOBJECT __repr__(); %MethodCode - QString str = QStringLiteral( "" ).arg( sipCpp->name(), sipCpp->dataProvider()->name() ); + QString str = QStringLiteral( "" ).arg( sipCpp->name(), sipCpp->dataProvider() ? sipCpp->dataProvider()->name() : QStringLiteral( "Invalid" ) ); sipRes = PyUnicode_FromString( str.toUtf8().constData() ); %End diff --git a/src/core/qgsmaplayer.h b/src/core/qgsmaplayer.h index 90f65cc83e0..d480e54f1cb 100644 --- a/src/core/qgsmaplayer.h +++ b/src/core/qgsmaplayer.h @@ -1273,7 +1273,7 @@ class CORE_EXPORT QgsMapLayer : public QObject #ifdef SIP_RUN SIP_PYOBJECT __repr__(); % MethodCode - QString str = QStringLiteral( "" ).arg( sipCpp->name(), sipCpp->dataProvider()->name() ); + QString str = QStringLiteral( "" ).arg( sipCpp->name(), sipCpp->dataProvider() ? sipCpp->dataProvider()->name() : QStringLiteral( "Invalid" ) ); sipRes = PyUnicode_FromString( str.toUtf8().constData() ); % End #endif