Payment shall not be made out of the state treasury to a witness attending for the Commonwealth in any prosecution for a misdemeanor unless it appears that the sum to which the witness is entitled cannot be obtained:
(1) If it be a case wherein there is a prosecutor and the defendant is convicted, by reason of the insolvency of the defendant, or
(2) If it be a case in which there is no prosecutor, by reason of the acquittal or insolvency of the defendant or other cause.
Code 1950, § 19.1-314; 1960, c. 366; 1975, c. 495.