The second Congress of Visegrád was a 1339 summit in Visegrád that decided that if Casimir III of Poland died without a son, the King of Poland would be the son of Charles I of Hungary, Louis I of Hungary, which is what happened.
When Casimir died in 1370 from an injury received while he was hunting, his nephew, Louis I, succeeded him as king of Poland in personal union with Hungary.