
163 Cal.App.4th 1526 (2008)
FORD MOTOR CREDIT COMPANY, Plaintiff and Respondent,
v.
DENNIS R. HUNSBERGER et al., Defendants and Appellants.
No. D050473.
Court of Appeals of California, Fourth District, Division One.
June 18, 2008.
*1529 Tatro & Zamoyski and Peter A. Zamoyski for Defendants and Appellants.
Severson & Werson, Mark J. Kenney, Katherine A. Knopoff, Ryan C. Donlon and Scott J. Hyman for Plaintiff and Respondent.

OPINION
McINTYRE, J.
In this case, defendant moved for an award of attorney fees as costs under Code of Civil Procedure section 998 after plaintiff dismissed its breach of guarantee action against him. (All undesignated statutory references are to the Code of Civil Procedure.) Defendant argued that he was entitled to attorney fees because plaintiff failed to obtain a more favorable judgment than his earlier settlement offer. (§ 998, subd. (c)(1).) The trial court denied the request and defendant appealed from the order.
As we will explain, section 998 does not create an independent right to attorney fees and defendant's only avenue for the recovery of attorney fees was subdivision (a) of Civil Code section 1717, which creates a bilateral right to attorney fees where, as here, a contract contains a unilateral attorney fee provision. However, this path to fees is blocked by subdivision (b)(2) of Civil Code section 1717, which bars any award of contractual attorney fees where an action has been voluntarily dismissed.

FACTUAL AND PROCEDURAL BACKGROUND
In September 2004, defendant D&S Mine, Inc. (D&S Mine), executed a written agreement to lease three trucks from Ford Motor Credit Company (Ford Credit). The lease agreement contained a provision allowing Ford Credit to recover its attorney fees if the agreement was placed with an attorney for collection. Dennis R. Hunsberger, the president of D&S Mine, signed the lease agreement and a written guarantee on behalf of the corporation. After Ford Credit delivered the trucks, it had Hunsberger execute a personal guarantee of D&S Mine's contractual obligations under the lease agreement.
When D&S Mine failed to pay under the lease agreement, Ford Credit filed this action against it for damages and to recover possession of its trucks and sought recovery against Hunsberger under the personal guarantee. After D&S Mine defaulted, Hunsberger served on Ford Credit a written offer to compro *1530 mise pursuant to section 998 whereby he offered to pay nothing and waive his attorney fees and costs in exchange for a dismissal with prejudice. Ford Credit allowed the offer to expire and then moved for summary judgment against Hunsberger, but the trial court denied the motion on the ground triable issues of material fact existed as to the enforceability of the personal guarantee. Ford Credit then dismissed its action against Hunsberger without prejudice and Hunsberger submitted a cost bill and moved for an award of attorney fees.
The trial court tentatively denied Hunsberger's request for attorney fees and partially granted his request for costs. After considering supplemental briefing, the trial court adopted its tentative ruling and Hunsberger timely appealed.

DISCUSSION
(1) Hunsberger claims the trial court erred in denying his request for attorney fees because he was entitled to an award of fees under Civil Code section 1717 and Code of Civil Procedure sections 1032, 1033.5 and 998. As explained below, we disagree.
(2) "[R]ecoverable litigation costs ... include attorney fees, but only when the party entitled to costs has a legal basis, independent of the cost statutes and grounded in an agreement, statute, or other law, upon which to claim recovery of attorney fees." (Santisas v. Goodin (1998) 17 Cal.4th 599, 606 [71 Cal.Rptr.2d 830, 951 P.2d 399] (Santisas); see §§ 1032, subds. (a)(4), (b), 1033.5, subds. (a)(10), (c)(5); Civ. Code, § 1717, subd. (a).) (3) Civil Code section 1717 governs the award of attorney fees based upon a contract and authorizes an award of attorney fees to a prevailing party if the contract provides for an award of attorney fees. (Civ. Code, § 1717, subd. (a).) Thus, the first issue to examine when evaluating a claim for attorney fees under Civil Code section 1717 is whether the contract at issue authorizes an award of attorney fees. (Khajavi v. Feather River Anesthesia Medical Group (2000) 84 Cal.App.4th 32, 62 [100 Cal.Rptr.2d 627] [without an attorney fees provision within the contract, a contract claim for attorney fees will fail].)
Hunsberger argued below that the lease agreement between Ford Credit and D&S Mine contained an attorney fee clause that allowed him to recover attorney fees as an item of costs. Ford Credit did not address this argument in its opposition papers; rather, it argued that Hunsberger was not entitled to attorney fees under subdivision (b)(2) of Civil Code section 1717 because it dismissed the only cause of action against Hunsberger. Thus, Ford Credit *1531 tacitly conceded that Hunsberger could rely on the attorney fee clause contained in the lease agreement and the trial court impliedly agreed when it addressed the arguments regarding application of Civil Code section 1717 on their merits. There was no need for the trial court to even address Civil Code section 1717 if it found Hunsberger was not a party to a contract that provided for an award of attorney fees.
For the first time on appeal, Ford Credit contends Hunsberger cannot rely on the attorney fee provision contained in the lease agreement because he was not a party to the lease and the lease and the guarantee were separate contracts. Hunsberger correctly argues that Ford Credit waived this argument by failing to raise it below. (Richmond v. Dart Industries, Inc. (1987) 196 Cal.App.3d 869, 874, 879 [242 Cal.Rptr. 184].) Although a litigant may change its legal theory on appeal when the new theory presents a question of law to be applied to undisputed facts (Nippon Credit Bank v. 1333 North Cal. Boulevard (2001) 86 Cal.App.4th 486, 500 [103 Cal.Rptr.2d 421]), the question of whether the personal guarantee was part of the lease agreement is not undisputed. In fact, Ford Credit sought attorney fees from Hunsberger in its complaint, repeated this assertion in its summary judgment motion and filed its own motion seeking attorney fees under the lease agreement should the trial court grant its summary judgment motion. Accordingly, we find Ford Credit has waived this contention.
Assuming that the attorney fee provision in the lease agreement allows Hunsberger to recover his attorney fees, we turn to Ford Credit's argument that subdivision (b)(2) of Civil Code section 1717 precludes such recovery. This argument raises a question of statutory construction that we address de novo. (Silver v. Boatwright Home Inspection, Inc. (2002) 97 Cal.App.4th 443, 448-449 [118 Cal.Rptr.2d 475].)
Under subdivision (b)(2) of Civil Code section 1717, attorney fees shall be awarded to a prevailing party in an action on a contract that contains an attorney fee provision, but "[w]here an action has been voluntarily dismissed... there shall be no prevailing party for purposes of this section." The Legislature added the quoted language in 1981 as a codification of the holding in International Industries, Inc. v. Olen (1978) 21 Cal.3d 218 [145 Cal.Rptr. 691, 577 P.2d 1031] (Olen). (Hsu v. Abbara (1995) 9 Cal.4th 863, 873 [39 Cal.Rptr.2d 824, 891 P.2d 804].) One of the principal purposes for disallowing attorney fees where a plaintiff has voluntarily dismissed a defendant before trial is to encourage parties to dismiss pointless litigation in moot cases or where the defendant is insolvent rather than maintain it merely to avoid liability for another party's attorney fees. (Olen, supra, 21 Cal.3d at p. 224; Santisas, supra, 17 Cal.4th at p. 621 ["The Olen majority soundly *1532 reasoned that attorney fees should not be awarded automatically to parties in whose favor a voluntary dismissal has been entered." (original italics)].)
Here, the trial court concluded that Hunsberger was not a prevailing party because Ford Credit voluntarily dismissed its only cause of action against him. Hunsberger first contends the trial court erred because subdivision (b)(2) of Civil Code section 1717 only applies where the entire action has been voluntarily dismissed, not just one cause of action or party. We reject Hunsberger's argument because it is inconsistent with the purpose of subdivision (b)(2) of Civil Code section 1717encouraging parties to dismiss pointless litigation and thereby avoid liability for attorney fees based on a contract cause of action. This purpose would be undermined if the voluntary dismissal of "an action" for purposes of subdivision (b)(2) of Civil Code section 1717 required the dismissal of all other claims being adjudicated in the same proceeding. (Gattuso v. Harte-Hanks Shoppers, Inc. (2007) 42 Cal.4th 554, 567 [67 Cal.Rptr.3d 468, 169 P.3d 889] [statutes must be read to avoid absurd results].)
Hunsberger next argues that he is entitled to attorney fees under section 998, subdivision (c)(1), which states in relevant part: "If an offer made by a defendant is not accepted and the plaintiff fails to obtain a more favorable judgment or award, the plaintiff shall ... pay the defendant's costs from the time of the offer." Hunsberger asserts that section 998 allows the recovery of attorney fees as costs and avoids the reach of subdivision (b)(2) of Civil Code section 1717.
(4) Subdivision (a) of section 998 provides that "[t]he costs allowed under Sections 1031 and 1032 shall be withheld or augmented as provided in this section." Section 998 is a cost-shifting statute that allows for the recovery of costs, including attorney fees as costs if there is a contractual or other statutory basis for them. Stated differently, section 998 does not independently create a statutory right to attorney fees; thus, it is different from numerous statutes wherein the Legislature expressly allowed for the recovery of attorney fees. (See generally Pearl, Cal. Attorney Fee Awards (Cont.Ed.Bar 2d ed. 2007) ch. 5, Attorney Fee Awards Under Other Fee-Shifting Statutes; id., ch. 17, Selected California Fee-Shifting Statutes.) In situations where there is an independent statutory right to attorney fees, a dismissal under subdivision (b)(2) of Civil Code section 1717 will not bar the fee award. (Damian v. Tamondong (1998) 65 Cal.App.4th 1115, 1124-1125 [77 Cal.Rptr.2d 262], and cases cited therein.)
Because this case does not involve a statute that creates an independent right to attorney fees, Hunsberger's only avenue for the recovery of attorney fees is contractual. Specifically, Hunsberger must rely on the unilateral *1533 attorney fee provision contained in the lease agreement that becomes bilateral by operation of law. (Civ. Code, § 1717, subd. (a).) This path is blocked, however, by subdivision (b)(2) of Civil Code section 1717. While Hunsberger correctly observes there is no case law holding that subdivision (b)(2) of Civil Code section 1717 trumps Code of Civil Procedure section 998, a plain reading of the relevant statutes leads to this result.
(5) The requirements for the recovery of costs and attorney fees under section 998 must be read in conjunction with subdivision (b) of section 1032. (§ 998, subd. (a); Murillo v. Fleetwood Enterprises, Inc. (1998) 17 Cal.4th 985, 1000 [73 Cal.Rptr.2d 682, 953 P.2d 858].) Turning to section 1032, this statute provides in relevant part that "[e]xcept as otherwise expressly provided by statute, a prevailing party is entitled as a matter of right to recover costs in any action or proceeding." (§ 1032, subd. (b), italics added.) Costs under this statute include attorney fees authorized by contract, statute or law (§ 1033.5, subd. (a)(10)) and a prevailing party includes "a defendant in whose favor a dismissal is entered." (§ 1032, subd. (a)(4).)
Thus, a defendant in whose favor a dismissal has been entered can recover his attorney fees as costs "[e]xcept as otherwise expressly provided by statute." (§ 1032, subd. (b).) The other statute that so provides is subdivision (b)(2) of Civil Code section 1717. As our Supreme Court explained, the legislative history of Civil Code section 1717 reflects an intent "to establish uniform treatment of fee recoveries in actions on contracts containing attorney fee provisions and to eliminate distinctions based on whether recovery was authorized by statute or by contract. A holding that in contract actions there is still a separate contractual right to recover fees that is not governed by [Civil Code] section 1717 would be contrary to this legislative intent." (Santisas, supra, 17 Cal.4th at p. 616.)
(6) Finally, Hunsberger argues we should "harmonize" the two statutes by holding that "[w]hen a defendant serves a [section] 998 Offer and the plaintiff opts to voluntarily dismiss the action without exceeding the statutory offer, the plaintiff will not be liable for pre-offer contractual attorneys' fees (in accord with [Civil Code] Section 1717 (b)(2)) but will be liable for all post-offer costs, including attorneys' fees (thus complying with the `stick' of Section 998)." The Legislature, however, did not provide for such a result and it was presumably aware of section 998 when it amended Civil Code section 1717 to include subdivision (b)(2). (People v. Cruz (1996) 13 Cal.4th 764, 775 [55 Cal.Rptr.2d 117, 919 P.2d 731] [the Legislature is presumed to be aware of existing law]; Taing v. Johnson Scaffolding Co. (1992) 9 Cal.App.4th 579, 585 [11 Cal.Rptr.2d 820] ["Section 998 has been part of California Law since 1851 [citation], and although it has undergone some modification over the years, it remains essentially unchanged in substance."].)


*1534 DISPOSITION
The order is affirmed. Respondent is entitled to its costs on appeal.
McConnell, P. J., and Huffman, J., concurred.
