A woman has escaped with a warning after making the mistake of taking her cannabis stash to court.

Photo: Unsplash / Sharon McCutcheon

The 51-year-old was due to appear in the Dunedin District Court on Friday to face a drink driving charge.

Senior Sergeant Craig Dinnissen said she realised she had cannabis in her pocket and handed it off to a friend who was accompanying her to court.

Mr Dinnissen said it was spotted by security staff, and the man she had handed it to was stopped and arrested as he attempted to enter the courthouse.

He said the man received a pre-charge warning for possessing cannabis, while the woman was warned that her actions could have led to charges of supplying the drug.