J.k. Rowling said this quote

I think the only reason I never lost my mind is that I knew I was innocent. That wasn't a happy thought, so the dementors couldn't suck it out of me...but it kept me sane and knowing who I am...helped me keep my powers...