Same issue may exist with other UDP's, haven't checked.
I don't know how the PointUDP collection gets empty entries, perhaps by adding then deleting one, but when such empty entries exist, the the following code fails with an exception:
UDPCollection udps = CivilApplication.ActiveDocument.PointUDPs;
UDP[] offsets = (UDP[])udps[offsetname];
As long as there are no empty entries, the same code works fine.
This is what one of these 'bad' collections looks like when debugging:
It took a bit of searching to figure out the problem with my code. I could see that the UDP with the name I was looking for was clearly there in the collection, yet it kept throwing the "Object not set to a reference" exception...but only in some drawings.
I've created a workaround, but it really shouldn't be needed.