Do not assume that all keys have subkeys.
It is possible to create keys without sub-keys.
While that is a questionable setup, the case this code
is fixing is when the main key does not contain an identity
(relying exclusively on separate UIDs), which is at least as
questionable.
So try to make everyone happy by supporting both (though possibly
breaking yet another corner-case...).