A teenager who had cannabis hidden in his boxer shorts when caught in a street deal had been taking the drug "all day every day", a court heard.
Jordan Keogh (19) had a "very serious problem" at the time he was arrested.
Judge Paula Murphy gave him a four-month suspended sentence.
Keogh, with an address at York Street, Dublin 2, pleaded guilty to possession of cannabis with intent to sell or supply.
Garda Sergeant Paul Keane told Dublin District Court the accused was seen at Thomas Street on March 23, 2019, when he was about to partake in a drugs transaction.
When gardaí approached, he cycled away but was stopped and brought to Kevin Street Garda Station where he was searched.
Two deals of cannabis worth €92 were found concealed in his boxer shorts. Keogh had no prior convictions of any kind.
A probation report on the accused was positive, his barrister Alan Grace said.
Keogh had gone through a bad period when he was "using cannabis all day every day", the court heard.
He was now living at home, had a much more stable lifestyle, hoped to get a safe pass and start working soon.
Keogh was also attending anger management classes and had been advised to stay away from his "old haunts".
"He does seem to be getting away from the behaviour that got him into this position in the first place," Mr Grace said.
"Hopefully, this is the wake-up call he needs." The court heard he had family support.
Judge Murphy said it was clear the accused had a "very serious problem" but he was taking steps to address this and had taken responsibility for his actions. She suspended the sentence for 18 months.