copyOrNull

Returns a copy of r if r is not null, or null otherwise.