check for keypairs before access attributes

This fixed this error: https://imgur.com/dPxzPXU

Not sure if this is only due to an old wallet type or not.