
547 N.W.2d 147 (1996)
250 Neb. 31
Mary SWIFT, Appellant,
v.
DAIRYLAND INSURANCE COMPANY, Appellee.
No. S-94-312.
Supreme Court of Nebraska.
May 10, 1996.
*148 Siegfried H. Brauer of Ross, Schroeder, Brauer & Romatzke, Kearney, for appellant.
Jeffrey H. Jacobsen and Timothy M. Welsh of Jacobsen, Orr, Nelson, Wright, Harder & Lindstrom, P.C., Kearney, for appellee.
WHITE, C.J., and CAPORALE, FAHRNBRUCH, LANPHIER, WRIGHT, CONNOLLY, and GERRARD, JJ.
WHITE, Chief Justice.
Plaintiff-appellant, Mary Swift, initiated this action against defendant-appellee, Dairyland Insurance Company (Dairyland), seeking recovery under her automobile insurance policy issued by Dairyland. Dairyland moved for summary judgment, contending that it had received inadequate notice of Swift's lawsuit against the uninsured tort-feasor and therefore was not bound by the *149 results of that litigation. The district court granted Dairyland's motion and Swift appeals.
Swift assigns the following errors: (1) The court erred in overruling Swift's motion for summary judgment and in sustaining Dairyland's motion for summary judgment; (2) the court erred in finding that Dairyland was entitled to notice of Swift's Dawson County lawsuit against the tort-feasor; (3) the court erred in finding that intervention had to be made available to Dairyland in the Dawson County lawsuit; (4) the court erred in finding that Swift had failed to afford Dairyland procedural due process concerning the Dawson County lawsuit; (5) the court erred in failing to enter judgment for Swift in the amount of the uninsured motorist limits in her policy; and (6) the court erred in failing to award Swift attorney fees, prejudgment and postjudgment interest, and litigation costs. We affirm.
Swift was injured in an automobile accident when riding as a passenger. The other car involved in the accident was driven by Bruce DeMoss. DeMoss had no liability insurance and was therefore uninsured. As a result of the accident, Swift incurred injuries for which she was partially compensated by the insurance carrier for the vehicle in which she was riding. At the time of the accident, Swift had a policy with Dairyland which provided uninsured motor vehicle coverage with a $50,000 per person limitation. Swift made demand upon Dairyland for additional payments to compensate her for her injuries. However, the parties failed to reach an agreement.
Swift thereafter filed a petition against Dairyland seeking a declaratory judgment and damages. In her petition, Swift alleged that "[t]he accident was caused solely by the failure of Bruce L. DeMoss to stop at a red light" and that DeMoss was uninsured. Swift further alleged that Dairyland was in breach of the insurance policy because it had refused to pay under the policy's uninsured motorist provision. Swift prayed for "a declaration of her rights under the contract of insurance with the defendant, for a jury determination of all relevant factual disputes, for judgment in the amount of her damages occasioned by defendant's breach," and for prejudgment and postjudgment interest and costs.
In response to Swift's petition, Dairyland filed a demurrer, contending that
said Petition does not state a cause of action against this defendant upon which relief can be granted, and in particular it appears that plaintiff is attempting to bring a direct action against an insurance company who may have some responsibility for the tortuous [sic] acts of another. Defendant contends that it is not a proper party defendant in this action.
On March 26, 1993, the court granted Dairyland's demurrer, concluding that it could not determine Dairyland's obligation to pay until the underlying liability of DeMoss was determined. In its order, the district court stated,
The court further finds that the plaintiff shall have twenty days from this day to amend its [sic] petition and if the petition cannot be amended to reflect a legal obligation on the part of the defendant to pay proceeds at this time, then in that event, the instant matter will be dismissed by the court.
On March 31, after the demurrer was granted but prior to the dismissal of Swift's petition against Dairyland, Swift filed an action against DeMoss in Dawson County. Dairyland had no notice of this lawsuit at the time the petition was filed. On May 28, Swift received a default judgment against DeMoss on the issue of liability only.
On June 15, the district court dismissed Swift's petition against Dairyland because Swift had not amended her petition. The dismissal stated, in relevant part, "[T]he court finds that no amendments have been submitted in the instant matter and the court therefore finds pursuant to its prior order that the instant matter should be and is dismissed with the costs of this action being taxed to the plaintiff." Swift did not appeal from the district court's order dismissing her petition.
On July 1, Dairyland received notice of the default judgment against DeMoss and of Swift's intention to proceed to trial in the *150 Dawson County suit on the issue of damages. Dairyland took no action and did not attempt to intervene in the litigation after it had received notice. On October 4, Swift obtained a judgment against DeMoss of approximately $93,000. After obtaining the money judgment against DeMoss, Swift again made demand upon Dairyland for payment under the insurance policy. Dairyland refused to pay.
Swift filed this breach of contract action seeking damages in the amount of $50,000, the uninsured motorist policy limit. Both parties moved for summary judgment. Swift sought a summary judgment to the extent of her uninsured motorist coverage with Dairyland for the damages established in her case against DeMoss. Dairyland sought summary judgment, contending that it was not bound by the judgment against DeMoss because of Swift's failure to provide Dairyland adequate notice of her action against DeMoss.
The district court granted Dairyland's motion for summary judgment and dismissed Swift's petition. The court, relying on Heisner v. Jones, 184 Neb. 602, 169 N.W.2d 606 (1969), held that Swift was required to give Dairyland full notice of the pending litigation as a matter of procedural due process so Dairyland could exercise its right to intervene. Swift appeals the granting of Dairyland's summary judgment.
We find that the district court was correct in dismissing Swift's petition. However, we reach this conclusion based on different grounds than those of the district court. A proper result will not be reversed merely because it was reached for the wrong reasons. Winfield v. CIGNA Cos., 248 Neb. 24, 532 N.W.2d 284 (1995); Healy v. Langdon, 245 Neb. 1, 511 N.W.2d 498 (1994). Where the record demonstrates that the decision of the trial court is correct, although such correctness is based on a different ground from that assigned by the trial court, the appellate court will affirm. Crystal Clear Optical v. Silver, 247 Neb. 981, 531 N.W.2d 535 (1995).
We conclude that this case should have been dismissed based on the grounds that Swift's second action against Dairyland was barred by the doctrine of res judicata. The district court's reasoning regarding whether Swift provided Dairyland adequate notice of her tort action was therefore unnecessary.
Dairyland did not raise the doctrine of res judicata. However, an appellate court may raise the issue of res judicata sua sponte. Kirkland v. Abramson, 248 Neb. 675, 538 N.W.2d 752 (1995).
The doctrine of res judicata bars relitigation not only of those matters actually litigated, but also of those matters which might have been litigated in an earlier proceeding if (1) the former judgment was rendered by a court of competent jurisdiction, (2) the former judgment was a final judgment, (3) the former judgment was on the merits, and (4) the same parties or their privies were involved in both actions. Id. Res judicata bars all of those issues which could have been raised in the prior proceeding upon the same facts sought to be presented in the subsequent action. State ex rel. Douglas v. Morrow, 216 Neb. 317, 343 N.W.2d 903 (1984).
There is no question in this case as to whether the same parties were involved or whether the court was of competent jurisdiction. However, whether the judgment was a final judgment on the merits of the case deserves more discussion.
The district court's orders sustaining the demurrer and dismissing the case were erroneous in light of this court's decision in Lane v. State Farm Mut. Automobile Ins. Co., 209 Neb. 396, 308 N.W.2d 503 (1981). Lane involved a plaintiff seeking recovery under the uninsured motorist provision of her insurance policy for personal injuries resulting from an accident with an uninsured motorist. In her original petition, the plaintiff joined the insurance company and the uninsured motorist as defendants. The court sustained a demurrer of the insurance company, finding misjoinder. The plaintiff amended her petition, naming the insurance company as the only defendant and praying for a judgment "for `all sums for which the insured, the plaintiff herein, shall be legally entitled to recover as damages from the owner or operator of the uninsured motor vehicle *151 in question....'" Id. at 398, 308 N.W.2d at 506.
The insurance company then filed another demurrer, claiming that the plaintiff failed to state a cause of action. This was denied, and the jury subsequently determined the liability and damages of the insurer. The insurance company appealed, contending that the plaintiff needed to plead and prove a judgment against the uninsured motorist in order to sustain her cause of action against the insurance company. This court held, however, that "it is not a prerequisite to recovery that judgment first be obtained against the uninsured motorist as a condition precedent to bringing suit against the insured motorist's liability carrier." Id. at 406, 308 N.W.2d at 509.
In reaching its holding, the Lane court noted that this state's uninsured motorist statute, Neb.Rev.Stat. § 60-509.01 (Reissue 1993), imposes "no requirement whatsoever that a suit be brought and judgment obtained against the uninsured motorist as a precondition to an action against the insurance carrier." Id. at 406, 308 N.W.2d at 509. The court, quoting the Supreme Court of Kansas, stated that
"the insured must be able to establish fault on the part of the uninsured motorist which gives rise to the damages and to prove the extent of those damages. This would mean that in a direct action against the insurer the insured has the burden of proving that the other motorist was uninsured, that the other motorist is legally liable for damage to the insured, and the amount of this liability...."
Id. at 405, 308 N.W.2d at 509 (quoting Winner v. Ratzlaff, 211 Kan. 59, 505 P.2d 606 (1973)).
Pursuant to Lane, it follows that Swift did not need to procure a judgment against DeMoss. The district court therefore erred when granting the demurrer and dismissing the case based upon the finding that the obligation of Dairyland under the uninsured motorist provision of the policy could not be determined.
However, a judgment rendered by a court of competent jurisdiction is conclusive upon the parties thereto, even though the judgment is erroneous. Morimoto v. Nebraska Children's Home Society, 176 Neb. 403, 126 N.W.2d 184 (1964). Moreover, a court's dismissal of a petition after sustaining a demurrer results in a final, appealable order. See Carlson v. Metz, 248 Neb. 139, 532 N.W.2d 631 (1995). Also, a judgment of dismissal after sustaining a demurrer based on the failure to state a cause of action is a judgment on the merits, even though by amendments a good cause of action might be stated. Knapp v. City of Omaha, 175 Neb. 576, 122 N.W.2d 513 (1963).
In this case, Dairyland filed its demurrer, contending that Swift failed to state a cause of action. The district court granted Dairyland's demurrer with leave to amend, concluding that Dairyland's liability could not be determined prior to a determination of liability on the part of the uninsured motorist, DeMoss. The court subsequently dismissed the action, finding that no amendment had been made to reflect liability on the part of Dairyland. This constitutes a final judgment on the merits.
In sum, Swift did not amend her petition. However, as Lane indicates, her original petition was sufficient to sustain a cause of action. Nonetheless, she failed to stand on her petition and appeal this erroneous order dismissing her petition. This order therefore became a final judgment on the merits, which now bars her from bringing the action that is the subject of the present appeal.
For the reasons stated above, we affirm the district court's order dismissing Swift's cause of action against Dairyland.
AFFIRMED.
