Make sure that projection is an ol.proj.Projection instance

When a projection has no extent configured, the current code will fail because projection is a string. This pull request fixed that.