First thing first: the goal in cutting hand is to prevent society to be messed up and it is applied to the people who do it as habit.
Secondly, there are many limitation for the punishment, the thief should be found guilty of stealing 3 times by the court(either 2 witnesses or thief should accept the crime). Other than that if there are cases like hunger, famine, or someone force thief to steal, or the thief is not an adult, the punishment won't be applied. Also the thief should steal more than an amount. But I dont know the amounts, it should be 1 dinar but I am not sure how much it is now. If it is less than this amount, the loss of the owner sgould be reimbursed.
Third thing is a word of Umar bin AlKhattab which kinda explains the hunger part of the situation:
Yahya ibn Abi Kathir reported: Umar ibn Al-Khattab, may Allah be pleased with him, said, “Do not cut the hand of the thief who steals dates in the year of famine.”
Source: Muṣannaf Abd al-Razzāq 18371
As-Sa’di reported: I asked Ahmad ibn Hanbal about this narration and he said, “No, the hand is not cut for theft when there is a need for that and the people are in famine and hardship.”
Source: I’lām al-Muwaqqi’īn 3/17
Note that the amounts and the regulations might be different in different school of thoughts, these information is mostly based on Hanafi. Other imams might have different icmaa's/implications but I m not very familiar with those.