A drug dealer was caught after police stopped a car in Bourne, Lincoln Crown Court was told.
Officers noticed a smell of cannabis when the vehicle came to a halt and as result Calum Westley was taken to the town’s police station to be searched.
Alex Wolfson, prosecuting, said: “He was found to have a large bag of cannabis in his trousers.”
Mr Wolfson said that the bag contained 26 grams of cannabis.
Text messages found on Westley’s phone indicated he had been involved in supplying drugs to friends for a short period of time.
The search at the police station also revealed Westley had a gram of amphetamine on him which was for his own use.
The court was told that Westley had no previous convictions.
Westley, of Westwood Drive, Bourne, admitted charges of supplying drugs and possession of drugs with intent to supply on March 19 this year.
He was given a 12 month community order with 120 hours of unpaid work and was ordered to forfeit £180 found on him at the time of his arrest.
Neil Sands, in mitigation, said Westley has stopped taking drugs since his arrest and is working via an agency.
Recorder Paul Mann QC, passing sentence, told him: “You get this chance once so take it.”