Map: Add safe method for accessing tiles

Also fix an invalid memory access in editor.
Editor: Fix invalid tile access