Those are not always easy questions, so I would not draw a hard line. I think this is a James 1:5 matter where you are going to have to ask God for wisdom.
I would affirm that there are times where the right thing to do is hang in there and contend for the faith. You use whatever godly influence you have to help point the church in the right direction, to be an encouragement to the leaders, and to point them to truth.
There are other settings where that just won’t be possible, and it might not be healthy for that believer to stay. That may be a very difficult decision. It is also not an easy decision, and you want to guard your witness and not be quarrelsome. Sometimes the best thing to do is for you to relocate and join another communion that is faithful to the truth.
I don’t think it’s a hard and fast category to sell a person over a screen concerning when to stay and when to go. This is a matter where you truly need the wisdom of God (James 1:5).