I think the only way to deal with this is what you have here - catch the exception. Is it dumping core? Please provide a little more info.