Add null checks to logging and fix typo in if-check. Pull Request: https://projects.blender.org/blender/blender/pulls/111055