Core/Maps: Fixed crash caused by using invalid coordinates

Closes #12532

(cherry picked from commit b43a46e449ac019670f1d97d4d62433e90371f5a)