A defendant who is in custody when an indictment, information, or affidavit on which she or he can be tried is filed may apply for a writ of habeas corpus attacking the indictment, information, or affidavit, or the defendant may move to dismiss the indictment, information, or affidavit. A defendant who has been confined for 30 days after her or his arrest without a trial shall be allowed a preliminary hearing upon application.

s. 140, ch. 19554, 1939; CGL 1940 Supp. 8663(147); s. 1,