Fixed the crashing problem of PassChanger

I added some code to prevent the crash of PassChanger.