Skip to content

Commit 9b2be7a

Browse files
committed
Other check for null pointer before calling decref
1 parent a1e826e commit 9b2be7a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/python/qgspythonutilsimpl.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -580,11 +580,13 @@ bool QgsPythonUtilsImpl::evalString( const QString& command, QString& result )
580580
bool success = nullptr != res;
581581

582582
// TODO: error handling
583+
if ( res )
584+
{
585+
if ( success )
586+
result = PyObjectToQString( res );
583587

584-
if ( success )
585-
result = PyObjectToQString( res );
586-
587-
Py_XDECREF( res );
588+
Py_XDECREF( res );
589+
}
588590

589591
// we are done calling python API, release global interpreter lock
590592
PyGILState_Release( gstate );

0 commit comments

Comments
 (0)