Fix missing NULL checks in key_share processing