Fix segfault on Java exception.