null-check encoder before dereferencing