Yup.
When the line descended from Charles I died out with his grand-daughter, Queen Anne (Her brother James Edward was disbarred from the succession due to his Catholic faith - a conflict of interest in the Head of the Church of England), the line of his sister, Elizabeth, took over in the person of her grandson, George I.
If I recall my history correctly, Parliament offered a compromise where James could rule as a Catholic but could only practice that faith in secret. There might still be a Stuart on the throne today if James had not been so adamant about it (not that it makes much difference to we commoners but it creates another interesting 'what if').