Fixed,
the problem was in other function…
function it_redirect_after_delete_post() {
global $post;
if ( $post ) { // <---- This if wasn't here and it returns the error
$post_type = $post->post_type;
if ( 'reservas_lentillas' == $post_type ) {
wp_redirect( get_admin_url() . '/edit.php?post_type=' . $post_type );
}
exit;
}
}
add_action( 'deleted_post', 'it_redirect_after_delete_post' );