Checking if format is not nil before logging

Hi there,

for some reason, when type of the variable `format` won't change, the type will be still `None`. Doing the logging call in method `detect_format`, which is intend to log the `format.name`, leads to an exception, causing to freeze the python script.

I just added a checking condition in method `detect_format `.

Regards,
Andreas