Code cleanup
Fix setErrorHandler

Setting a null error handler causes the default error handler
to be registered. Previously, this would have thrown a
NullPointerException.