A serial burglar raided a pub and stole £318 in cash bags waiting to be banked.
Simon Wilkinson told bar staff he was looking for someone before walking up to the second floor of the Railway Bell in Comberton Hill, Kidderminster.
A suspicious barman alerted the publican - and he caught Wilkinson red-handed.
The money was handed over, Worcester Crown Court heard.
Father-of-three Wilkinson, 33, of Brook Street, Kidderminster, pleaded guilty to burglary.
He was given a nine-month jail term, suspended for 18 months, with a 15-month drug rehabilitation requirement.
He told police he burgled to pay off drug debts and had met his dealer just minutes before the raid on July 9 this year, said Kerry Moreton, prosecuting.
Wilkinson had 16 burglaries on his record plus theft and robbery.
Cathlyn Orchard, defending, said he had an appalling record which stemmed from an addiction to heroin and crack cocaine.
He was still awaiting sentence for possession of heroin and theft of a vehicle and had spent 36 days in custody on remand.
While locked up he had worked with the drug rehabilitation team to get clean.
The last offence had impacted on his children and served as a wake-up call to mend his ways.
Recorder Denis Desmond said he was giving Wilkinson a last chance for an opportunistic crime committed while he was on bail.
Comments: Our rules
We want our comments to be a lively and valuable part of our community - a place where readers can debate and engage with the most important local issues. The ability to comment on our stories is a privilege, not a right, however, and that privilege may be withdrawn if it is abused or misused.
Please report any comments that break our rules.
Read the rules here