And David was the father of Solomon by the wife of Uriah
Matthew 1:6 ESV
You remember David? The King who committed adultery, then plotted a murder to cover up his sin? Yes he is an ancestor of Jesus. God used the brokenness of these relationships in the line of Christ. Through the messiness and brokenness of this world Christ came. Christ meets you in your brokenness too.