(a) In a criminal case, when all of the charges against the defendant are disposed of by acquittal, dismissal, probation before judgment, nolle prosequi, or stet, the court shall advise the defendant that the defendant may be entitled to expunge the records and any DNA sample and DNA record relating to the charge or charges against the defendant in accordance with Title 10, Subtitle 1 of this article and Title 2, Subtitle 5 of the Public Safety Article.
(b) The failure of a court to comply with subsection (a) of this section does not affect the legality or efficacy of the sentence or disposition of the case.