RAAK / GSI 1 / 17

NEW YORK (AP) — The bong-toss case against Amanda Bynes will be dismissed if she stays out of trouble for six months and goes to counseling.

RELATED: The 13 Biggest Celebrity Surprises of 2013

A Manhattan judge on Friday allowed the adjournment in contemplation of dismissal, which means the troubled actress does not have to admit guilt. She must attend counseling twice a week for six months.

RELATED: Celebrities in Trouble With the Law in 2013

The "Hairspray" actress didn't appear in court. An affidavit filed on her behalf by attorney Gerald Shargel said she understood the agreement.

RELATED: Amanda Bynes misses first post-rehab mandatory court date

Bynes was charged last spring with reckless endangerment and marijuana possession after building managers called police because they said she was smoking pot in the lobby of her Manhattan apartment. When officers entered her 36th-floor apartment, they said they saw her heave a bong out the window.