56:4 If one accidentally said shehakol over any food item, even bread or wine, it is effective after the fact. (Actually, it is effective even if one intentionally said shehakol, though it is improper to do so. See Mishnah Brurah 206:1.)
56:5 One should be careful and pay attention to what food he is reciting a bracha over. But what if one makes a mistake? Let’s say that someone thought he was holding a cup of wine and he said the start of the bracha but he realized that it was really beer before he said the words “borei pri hagafen,” so he changed gears and finished with shehakol. In this case, he need not go back and start the bracha again. All the more so, if he thought he was about to drink beer and started saying shehakol but he realized it was wine and completed the bracha with hagafen, it is effective because even if he had finished saying shehakol over wine, it would have worked.