
115 S.W.3d 797 (2003)
Loncelle HOLLOWAY, Appellant,
v.
The STATE of Texas, Appellee.
No. 03-03-00090-CR.
Court of Appeals of Texas, Austin.
August 29, 2003.
Frank W. Bryan Jr., Austin, for appellant.
C. Bryan Case, Jr., Asst. Dist. Atty., Austin, for appellee.
*798 Before Justices KIDD, B.A. SMITH and PATTERSON.

OPINION
JAN P. PATTERSON, Justice.
A jury found appellant Loncelle Holloway guilty of delivering less than one gram of cocaine. See Tex. Health & Safety Code Ann. § 481.112(a), (b) (West Supp. 2003). The court assessed punishment at fifteen months in a state jail. In his only point of error, appellant contends he was denied equal protection of the law because the court did not give him credit for the time he spent in county jail following his arrest. We overrule this contention and affirm the conviction.
In state jail felony cases, the trial court has discretion whether to grant the defendant credit against his sentence for any jail time served between his arrest and sentencing. Tex.Code Crim. Proc. Ann. art. 42.12, § 15(h)(2) (West Supp. 2003). There is a limitation on this discretion, however. If the defendant is assessed the maximum sentence, and if the defendant was confined following his arrest because he was unable to make bail due to indigence, he must be given credit for his presentence jail time. Ex parte Bates, 978 S.W.2d 575, 577 (Tex.Crim.App. 1998). To deny time credit in such a situation would cause the defendant to suffer incarceration beyond the maximum punishment provided for the offense because of his indigence, and thus deny him equal protection of the laws. Ex parte Harris, 946 S.W.2d 79, 80 (Tex.Crim.App. 1997); see also Ex parte Chamberlain, 586 S.W.2d 547, 547-48 (Tex.Crim.App.1979); Caraway v. State, 550 S.W.2d 699, 704-05 (Tex.Crim.App.1977).
The State argues that this issue is not appropriate for appeal, but should instead be raised in a post-conviction habeas corpus proceeding. It is true that this issue has most often been raised in habeas corpus proceedings. But in Caraway, the court of criminal appeals granted the defendant relief in a direct appeal. 550 S.W.2d at 705. We believe that we should do the same if the record is adequate to decide the constitutional claim.[1]
A state jail felony is punishable by confinement in a state jail for a maximum term of two years. Tex. Pen.Code Ann. § 12.35(a) (West 2003). Appellant was arrested on March 15, 2002, and his bail was set at $3000. Two days later, an attorney was appointed to represent him. See Tex. Code Crim. Proc. Ann. art. 26.04 (West Supp.2003) (procedure for appointing counsel for indigent defendants). No bail bond is in the clerk's record. We will assume appellant remained in county jail from the day of his arrest until the day he was sentenced in open court, December 9, 2002, a period of approximately eight months and three weeks. Appellant's fifteen-month sentence is nine months less than the maximum applicable to the offense. Thus, appellant's indigence will not cause him to be incarcerated for more than the two-year maximum term, and the district court was not required to give him credit for his presentence jail time. Bates, 978 S.W.2d at 577.
Appellant asks this Court to adopt the holding in Johnson v. Prast, 548 F.2d 699 (7th Cir.1977), a federal habeas corpus proceeding attacking a state sentence on equal protection grounds. That court concluded *799 that it violates equal protection for an indigent defendant to be incarcerated for an offense longer than he would have been had he not been indigent, even if the total time of incarceration does not exceed the maximum provided for the offense. Id. at 702. The court held that in every case, the sentencing court must take into consideration any presentence incarceration resulting from the defendant's inability to post bond. Id.
Even if we were to adopt this holding, it would not benefit appellant because the record before us is silent as to whether the trial court considered his presentence incarceration in assessing punishment. Insofar as the record reflects, the court may have considered appellant's offense to be "worth" two years in state jail and imposed the fifteen-month sentence to allow for his presentence incarceration.
Appellant argues, citing Johnson, that we should presume that the trial court did not consider his presentence jail time in the absence of evidence to the contrary. What Johnson actually held, however, was that the burden of proof in the habeas corpus proceeding was on the State: "Unless the state proves in the habeas-corpus action that the judge, in fixing the sentence, gave consideration in the sense stated above to the time served before sentencing, the prisoner will be entitled to credit." Id. at 703. This holding has no application in this direct appeal, in which neither appellant nor the State has had any opportunity to adduce evidence on the issue appellant seeks to raise. In this respect, we agree with the State that appellant should advance his contentions in a habeas corpus proceeding in which a full record may be developed. We will not presume error on appeal when there is a viable theory that supports the trial court's action. See State v. Ross, 32 S.W.3d 853, 858 (Tex.Crim.App.2000).
In summary, no equal protection violation is shown by the record before us because appellant's total term of incarceration would not exceed the maximum allowable punishment even if his presentence jail time were added to the sentence imposed by the court. The record is not adequate to address appellant's additional arguments.
The point of error is overruled, and the judgment of conviction is affirmed.
NOTES
[1]  Appellant did not object when the court announced that it was not giving him jail time credit, nor did he file a motion for new trial raising this issue. Although the State argues that the issue should be raised by habeas corpus, it does not argue that the alleged error was not preserved for appeal.
