
522 S.E.2d 528 (1999)
240 Ga. App. 156
BARBER
v.
The STATE.
No. A99A1606.
Court of Appeals of Georgia.
September 14, 1999.
Reconsideration Denied September 27, 1999.
Certiorari Denied February 11, 2000.
*529 William L. Barber, pro se.
C. Paul Bowden, District Attorney, William D. Bonds, Assistant District Attorney, for appellee.
ELDRIDGE, Judge.
On March 24, 1994, defendant-appellant William L. Barber entered a plea of guilty but mentally ill to two charges of child molestation.[1] The trial court (hereinafter the "sentencing court") accepted the Alford[2] plea and entered judgment thereon. In October 1998, Barber filed a petition to correct a void judgment, claiming that, at the time he entered his plea, the sentencing court failed to adhere to the procedural requirements of OCGA § 17-7-131(b)(2).[3] The trial court dismissed the petition on March 12, 1999, and Barber appeals. Held:
1. In his first enumeration of error, Barber contends that the trial court erred in ruling that it was without jurisdiction to consider his petition. We agree, but nonetheless affirm the dismissal of Barber's petition.
(a) In its order, the trial court found that Barber's petition came outside the term of court in which it was entered. It therefore determined that Barber's only recourse in challenging the validity of the judgment on his guilty plea was through a habeas corpus proceeding. See OCGA § 9-14-42(a); see also Grice v. State, 236 Ga.App. 379, 380, 511 S.E.2d 909 (1999).
However, Barber's petition asserted that the judgment was void due to the failure of the sentencing court to comply with OCGA § 17-7-131(b)(2). The Supreme Court of Georgia has held that, under OCGA § 9-14-42(a), "the question of whether the requirements of OCGA § 17-7-131 were violated is not cognizable in a habeas action[,]" because it is based upon an alleged denial of rights under state law. Parker v. Abernathy, 253 Ga. 673, 674, 324 S.E.2d 191 (1985).
Therefore, the trial court's dismissal of the petition on the stated basis was error. However, the dismissal was proper on another basis, and a dismissal of a petition will be *530 affirmed if it is right for any reason. See North Fulton Med. Center v. Roach, 265 Ga. 125, 127(1), 453 S.E.2d 463 (1995); Little v. Fleet Finance, 224 Ga.App. 498, 503-504(1), 481 S.E.2d 552 (1997).
(b) Outside the term of court, the trial court had subject matter jurisdiction to invalidate Barber's sentence if it was, in fact, void. A void judgment is "a mere nullity," and an individual may attack such judgment "when it becomes material to the interest of the parties to consider it." Hubbard v. State, 225 Ga.App. 154, 155, 483 S.E.2d 115 (1997). See also OCGA § 17-9-4; Bryant v. State, 229 Ga.App. 534, 536(1), 494 S.E.2d 353 (1997).
However, in order for a trial court to have the power to exercise the subject matter jurisdiction to correct the judgment outside the term of court, the judgment must be, in fact, void. If the judgment is not void, a trial court has no further subject matter jurisdiction outside the term of court and the petition must be dismissed.
2. In this case, the judgment was not void, because the procedural requirements of OCGA § 17-7-131(b)(2) were fulfilled when Barber's plea was taken and a factual basis for Barber's plea was established. The trial court, in its order dismissing Barber's petition, found that the record from the plea hearing demonstrated that the sentencing court's procedures were "sufficient to the facts and law in that a mental condition hearing (plea hearing) was held and that there was basis for the plea and that the same was voluntarily made." This finding is supported by the record.[4]
The transcript demonstrates that defense counsel obtained an independent psychiatric report upon which the plea was based and read Barber's extensive psychiatric history into the record for the sentencing court's consideration. Further, at the plea hearing, the sentencing court inquired into Barber's history of mental illness prior to ruling that the evidence was sufficient to support the plea of guilty but mentally ill. The sentencing court then accepted and sentenced Barber upon such plea.
Under the circumstances, the procedures utilized by the trial court were sufficient, so that the judgment was valid. Therefore, outside the term of court, the trial court lacked jurisdiction to act on Barber's petition, i.e., to "correct" the judgment. The petition was properly dismissed.
3. However, even if the plea procedures were insufficient under OCGA § 17-7-131(b)(2), the "guilty but mentally ill" plea is for the benefit of the defendant, because (1) it provides for mental health treatment during the sentence, and (2) it recognizes a reduced level of culpability. Therefore, if the sentencing court failed to strictly comply with OCGA § 17-7-131(b)(2), such failure inured to Barber's benefit and was harmless error. See Kirkland v. State, 166 Ga.App. 478, 482(2), 304 S.E.2d 561 (1983).
Further, any error by the sentencing court in accepting the plea was induced when Barber sought a guilty but mentally ill plea and then failed to contemporaneously object to the procedure utilized to enter such plea and file a direct appeal. Therefore, any objection is waived.
Judgment affirmed.
POPE, P.J., and SMITH, J., concur.
NOTES
[1]  Two charges of aggravated child molestation were nolle prossed by the state.
[2]  North Carolina v. Alford, 400 U.S. 25, 91 S.Ct. 160, 27 L.Ed.2d 162 (1970).
[3]  Under OCGA § 17-7-131(b)(2),

[a] plea of guilty but mentally ill at the time of the crime ... shall not be accepted until the defendant has undergone examination by a licensed psychologist or psychiatrist and the court has examined the psychological or psychiatric reports, held a hearing on the issue of the defendant's mental condition, and is satisfied that there is a factual basis that the defendant was mentally ill at the time of the offense... to which the plea is entered.
[4]  The transcript of the plea hearing shows that the plea was entered voluntarily and knowingly. Logan v. State, 256 Ga. 664, 352 S.E.2d 567 (1987); Boyette v. State, 217 Ga.App. 593, 595(2), 458 S.E.2d 397 (1995); Morgan v. State, 191 Ga.App. 367(1), 381 S.E.2d 583 (1989).
