Shop workers who caught a customer trying to steal a purse from the staff room locked the store to stop him escaping.
But Simon Hornby kicked the door until the lock broke and fled from Computer World in North Street, Brighton.
Hornby, 33, of Donald Hall Road, Brighton, was later arrested.
He admitted a charge of attempted theft when he appeared at Lewes Crown Court yesterday.
The court heard Hornby was seen attempting to steal a purse from a member of staff's handbag left in a back room on December 21 last year. When he was confronted, he returned the purse and tried to escape but the door was locked.
Beresford Kennedy, defending, told the court Hornby, who has previous convictions, had committed the offence to pay for his crack cocaine and heroin habit.
He has started a drug rehabilitation course.
Judge Simon Coltart agreed to defer sentence until Hornby has finished the course. But he warned him if he was in trouble again he would face jail.
The judge said: "You must commit no further offences and progress with the rehabilitation course.
"Only if that is satisfactory will you avoid custody."
Hornby will be sentenced on March 15 next year.
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 hereComments are closed on this article