Fix segfault when encoder initialization fails.