Is the program that is crashing something you wrote?

If so, it would be much better to stop it from crashing in the first place - by adding apt error handling etc.