Handle Paint panics to workaround Go issue #8588.

http://golang.org/issue/8588