It does sound unfair, but see here for supporting sources https://www.nolo.com/legal-encyclopedia/tenants-right-break-...
Going into court you have no/low knowledge of what your landlord has actually done. If they pull out their ads they posted on the internet or on some zero readership newspaper. The judge will see they have made an effort and you probably are grasping at straws because you have nothing in the way of proof. If you’re lucky, judge would hear some expert testimony (realtor) that says the apartment/market/etc should have been filled within 1-2 months and they feel it’s highly unusual the unit would remain unfilled for 6 months. But even still, if the law says the landlord is required to market the property it might not imply they have to be good at marketing the property. So there’s a grey area where it could go either way, and he can proof that you can’t match.
In my country, me moving out and saying I won't continue to pay, while the contract end date is still far in the future would of course be a breach of the contract. But that doesn't mean the landlord then can let the house sit empty for the rest of the contract time and force me to cover their loss. Landlord would instead have to try and minimize their losses by finding a new tenant, and what I would owe the landlord would be their costs to do so and the time the apartment stood empty.
Edit: "mitigation of damage" might be the US term for it. From Cornell: The mitigation of damages doctrine, also known as the doctrine of avoidable consequences, prevents an injured party from recovering damages that could have been avoided through reasonable efforts. The duty to mitigate damages is most traditionally employed in the areas of tort and contract law. To me that reads like if you want to void the contract, and the landlord doesn't accept a reasonable tenant to take over, the landlord might have to carry their losses themselves. My guess (given laws about renting being very in favor of tenants) is that there most places even might be explicit laws allowing the tenant to do this.