In the spirit of @MoziburUllah's answer, I'd like to add another perspective on the subject, with the example of Fichte.
Losing your faith, let alone struggling with it (there's a common Jewish statement that a man who struggles with faith only makes his faith stronger, and it's a very important aspect of Judaism), can't possibly be a "bad philosophy".
With Fichte the case was not only that it wasn't a bad philosophy, it even inspired him to recreate his entire philosophy and his views of God's relation to the world.
In his youth, Fichte stated that the moral actions you do in this world, will most certainly provide you with a good response from the surrounding, and the world will be 'in your favor', because if God is moral (better put - God IS morality) and God is good, and God has a direct connection to the world, then our good actions must be replied with good response from the world (I'm over-simplifying his philosophy here, for the sake of the question).
Soon after, Fichte went through a major crisis in his life, getting disbarred and banished from his country, and had to flee to Berlin.
Fichte didn't understand what was wrong - he did good to the world, he showed everyone the truth, tried to hell humankind, and what was the response of the world? Banishment!
So now, Fichte started struggling with his philosophy, and eventually came up with the idea that our moral actions doesn't really have direct "good" responses in our world, but in an outside-of-the-senses, unknown world of "actions" (similar to heaven, but one that's continually and dynamically changes along with our world).
Here, we can see that Fichte's struggle and almost (if not entirely) losing faith in his younger philosophy and views of God, caused him to not only not ending up with a bad philosophy, but rather (arguably better) a new philosophy which better fit his new views and experience with the world. Fichte didn't "betray" his younger philosophy, if that's what you mean by "bad philosophy", but rather adjusted it to his new experiences (something his student Schelling used to do a lot, and something that Martin Buber said was the essence of philosophy - according to his anthropology, the philosopher must be connected to his experience with life and should always learn from it and build his philosophy using that knowledge).
*note - I'm sorry I didn't provide quotations, I'm writing this on the road and don't have access currently to any book to quote from. If anyone would like to help me with this in the comments I'll be grateful.