Add basic error checking

The current state of visualizer is vulnerable to some very simple errors. For example, if the source textarea consists of the single `[` character, the interface becomes stuck in the infinite loop.

The same story goes with moving beyond the edges: it is always OK to move the pointer, but if you try to alter cell values, you fail with TypeError (which is especially not so cool because these errors are silently caught without any further inspection).

This patch adds some error checking.