fix zoom to layer extent crash (fixes #10516)