diff --git a/portable/Common/mpu_wrappers_v2.c b/portable/Common/mpu_wrappers_v2.c index 87e849edf..beb21d271 100644 --- a/portable/Common/mpu_wrappers_v2.c +++ b/portable/Common/mpu_wrappers_v2.c @@ -324,9 +324,16 @@ static OpaqueObjectHandle_t MPU_GetHandleAtIndex( int32_t lIndex, uint32_t ulKernelObjectType ) /* PRIVILEGED_FUNCTION */ { + OpaqueObjectHandle_t xObjectHandle = NULL; + configASSERT( IS_INTERNAL_INDEX_VALID( lIndex ) != pdFALSE ); - configASSERT( xKernelObjectPool[ lIndex ].ulKernelObjectType == ulKernelObjectType ); - return xKernelObjectPool[ lIndex ].xInternalObjectHandle; + + if( xKernelObjectPool[ lIndex ].ulKernelObjectType == ulKernelObjectType ) + { + xObjectHandle = xKernelObjectPool[ lIndex ].xInternalObjectHandle; + } + + return xObjectHandle; } /*-----------------------------------------------------------*/