I know you've got your answer but i found the hadith regarding it too for your benefit:
Abu Hurairah reported that the Prophet (S) said:"Whoever forgets he is fasting, and eats or drinks is to complete his fast, as it is Allah who fed him and gave him something to drink." [Al-Bukhari, Muslim and others]
Ibn Abbas reported that the Prophet (S) said:" Allah has excused for my Ummah mistakes, forgetfulness and what they are forced to do".
[Tahawee, al-Hakim and Daraqutni; Sahih].
Hope it helps