Is returning undef of type nil here actually safe? It seems to be, but I don't understand the details of this operation nor any way to exercise this code path.