The flaw in this function is that users with 0 karma do not have a karma field on their user object
Out of interest, is this true of all users with 0 karma, or specifically users who’ve never received a vote? That is, if I vote on a comment of a 0-karma user and then retract it, will they have a karma object? (Or “users who have no current votes applied to them” would also be plausible, who wouldn’t have a karma object in that situation but would if I voted up and someone else voted them back down to 0.)
Out of interest, is this true of all users with 0 karma, or specifically users who’ve never received a vote? That is, if I vote on a comment of a 0-karma user and then retract it, will they have a karma object? (Or “users who have no current votes applied to them” would also be plausible, who wouldn’t have a karma object in that situation but would if I voted up and someone else voted them back down to 0.)