coverity#982760 Dereference null return value
Change-Id: I779fa5fa418370dd6c53308943374e981f65ae29
This commit is contained in:
parent
c6c135930c
commit
5bdc28028c
@ -68,6 +68,13 @@ extern "C" LO_DLLPUBLIC_PYUNO
|
||||
namespace pyuno
|
||||
{
|
||||
|
||||
enum __NotNull
|
||||
{
|
||||
/** definition of a no acquire enum for ctors
|
||||
*/
|
||||
NOT_NULL
|
||||
};
|
||||
|
||||
/** Helper class for keeping references to python objects.
|
||||
BEWARE: Look up every python function you use to check
|
||||
whether you get an acquired or not acquired object pointer
|
||||
@ -88,6 +95,12 @@ public:
|
||||
|
||||
PyRef( PyObject * p, __sal_NoAcquire ) : m( p ) {}
|
||||
|
||||
PyRef( PyObject * p, __sal_NoAcquire, __NotNull ) : m( p )
|
||||
{
|
||||
if (!m)
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
PyRef( const PyRef &r ) : m( r.get() ) { Py_XINCREF( m ); }
|
||||
|
||||
~PyRef() { Py_XDECREF( m ); }
|
||||
|
@ -265,7 +265,7 @@ PyObject *PyUNO_Enum_new( const char *enumBase, const char *enumValue, const Run
|
||||
PyObject* PyUNO_Type_new (const char *typeName , TypeClass t , const Runtime &r )
|
||||
{
|
||||
// retrieve type object
|
||||
PyRef args( PyTuple_New( 2 ), SAL_NO_ACQUIRE );
|
||||
PyRef args(PyTuple_New( 2 ), SAL_NO_ACQUIRE, NOT_NULL);
|
||||
|
||||
PyTuple_SetItem( args.get() , 0 , PyStr_FromString( typeName ) );
|
||||
PyObject *typeClass = PyUNO_Enum_new( "com.sun.star.uno.TypeClass" , typeClassToString(t), r );
|
||||
|
Loading…
x
Reference in New Issue
Block a user