Bugfix: Crashing when attempt to paint off-map.

NOTE:
Painting and editing in general is quite broken.