To reproduce, attach both a vvol and an RDM to a VM and use Get-VmdkFromWindowsDisk.
The issue is on line 907, there is a null exception if there's an RDM in the set of disks attached to a VM.
The workaround I used was to filter out RDMs:
$vmDisk = $vm | Get-HardDisk | Where-Object { $_.DiskType -ne 'RawPhysical' } |Where-Object {$_.ExtensionData.backing.uuid.replace("-","") -eq $VMdiskSerialNumber.SerialNumber}