Error if logging an null error

If a null error object is logged, it causes a NullReferenceException.