We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4464ab6 commit 27b7ae8Copy full SHA for 27b7ae8
Source/PythonEngine.pas
@@ -7311,11 +7311,12 @@ function TPythonModule.GetVarAsVariant( const varName : AnsiString ) : Variant;
7311
with Engine do
7312
begin
7313
obj := GetVar( varName );
7314
- try
7315
- Result := PyObjectAsVariant( obj );
7316
- finally
7317
- Py_XDecRef(obj);
7318
- end;
+ if Assigned(obj) then
+ try
+ Result := PyObjectAsVariant( obj );
+ finally
+ Py_XDecRef(obj);
7319
+ end;
7320
end;
7321
7322
0 commit comments