Fixed possible null reference exception in logger