Check if layer exists before using it in stateManager.
Merge pull request #207 from ozone-development/bug/204/state-manager-layer-check

bug/204/state-manager-layer-check