Bugfix: Ensure that layer exists
Bugfix: Ensure that layer exists

We check if layer is available after using it. So I moved `layer.useAlpha` *after* checking if layer is null or undefined.

It caused sometimes:
> TypeError: Cannot set property 'useAlpha' of undefined
For example when another script messed with document or canvas height.

rezoner/playground