Skip to content

Commit df8862b

Browse files
committed
return if no widget
1 parent d6c0899 commit df8862b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/gui/editorwidgets/qgsqmlwidgetwrapper.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,20 @@ void QgsQmlWidgetWrapper::setQmlCode( const QString &qmlCode )
8383

8484
void QgsQmlWidgetWrapper::setFeature( const QgsFeature &feature )
8585
{
86-
if ( mWidget )
87-
{
88-
QgsExpressionContext context = layer()->createExpressionContext();
89-
context << QgsExpressionContextUtils::globalScope()
90-
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
91-
<< QgsExpressionContextUtils::layerScope( layer() );
86+
if ( !mWidget )
87+
return;
9288

93-
context.setFeature( feature );
89+
QgsExpressionContext context = layer()->createExpressionContext();
90+
context << QgsExpressionContextUtils::globalScope()
91+
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
92+
<< QgsExpressionContextUtils::layerScope( layer() );
9493

95-
QmlExpression *qmlExpression = new QmlExpression();
96-
qmlExpression->setExpressionContext( context );
94+
context.setFeature( feature );
9795

98-
mWidget->rootContext()->setContextProperty( "expression", qmlExpression );
99-
}
96+
QmlExpression *qmlExpression = new QmlExpression();
97+
qmlExpression->setExpressionContext( context );
98+
99+
mWidget->rootContext()->setContextProperty( "expression", qmlExpression );
100100
}
101101

102102
void QmlExpression::setExpressionContext( const QgsExpressionContext &context )

0 commit comments

Comments
 (0)