Make sure $modx->resource is existing for logging

When pThumb is used in the mgr context for example, the $modx->resource object is not always set, what leads to a fatal error (using get() on a non-object) in that case. The added check prevents this...