Prevents orphaned maplayers from breaking the map detail views

TODO: orphaned maplayers should be properly removed
Merge pull request #804 from MAPC/patch-804

Prevents orphaned maplayers from breaking map detail views