T.S.
In this situation, specifically, I think it's fine you let her eat it. You saw the child, you saw the offer, you saw the child also eating the candy, etc.
In general, however, I think one issue is that children shouldn't offer or accept ANYTHING directly between themselves. I have taught my son that if he wants to share a snack with another child he ASKS THEIR PARENT. If another child offers him something, he says "You'll have to ask my mom."
That way no child is accepting something from a stranger, they're always getting it from their own parent (who may have moments before gotten it from a stranger).