Any magistrate or officer, having notice of any unlawful act provided against in this chapter, who neglects or refuses to do the magistrate’s or officer’s duty in the prevention of the public offense commits a Class C misdemeanor.