diff options
-rw-r--r-- | pyuno/source/module/pyuno_adapter.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pyuno/source/module/pyuno_adapter.cxx b/pyuno/source/module/pyuno_adapter.cxx index 3a178fe247be..8bd0aab6772d 100644 --- a/pyuno/source/module/pyuno_adapter.cxx +++ b/pyuno/source/module/pyuno_adapter.cxx @@ -363,20 +363,20 @@ Any Adapter::invoke( const OUString &aFunctionName, void Adapter::setValue( const OUString & aPropertyName, const Any & value ) throw( UnknownPropertyException, CannotConvertException, InvocationTargetException,RuntimeException) { + if( !hasProperty( aPropertyName ) ) + { + OUStringBuffer buf; + buf.appendAscii( "pyuno::Adapater: Property " ).append( aPropertyName ); + buf.appendAscii( " is unknown." ); + throw UnknownPropertyException( buf.makeStringAndClear(), Reference< XInterface > () ); + } + PyThreadAttach guard( mInterpreter ); try { Runtime runtime; PyRef obj = runtime.any2PyObject( value ); - if( !hasProperty( aPropertyName ) ) - { - OUStringBuffer buf; - buf.appendAscii( "pyuno::Adapater: Property " ).append( aPropertyName ); - buf.appendAscii( " is unknown." ); - throw UnknownPropertyException( buf.makeStringAndClear(), Reference< XInterface > () ); - } - PyObject_SetAttrString( mWrappedObject.get(), (char*)TO_ASCII(aPropertyName), obj.get() ); raiseInvocationTargetExceptionWhenNeeded( runtime); |