diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-04-18 13:38:07 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-04-18 13:38:07 +0300 |
commit | 127c89629149e223b5a0c625c935941d513f857e (patch) | |
tree | 143223eeb882af3118d9da9158633f8e6f6725be /lib/ansimage | |
parent | 55a2fb7803ebb2177d43736c7c682a7f461cf19a (diff) |
Fix panic handling
Diffstat (limited to 'lib/ansimage')
-rw-r--r-- | lib/ansimage/ansimage.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ansimage/ansimage.go b/lib/ansimage/ansimage.go index 73425be..7320848 100644 --- a/lib/ansimage/ansimage.go +++ b/lib/ansimage/ansimage.go @@ -129,8 +129,10 @@ func (ai *ANSImage) Render() []tstring.TString { go func(row, y int) { defer func() { err := recover() - debug.Print("Panic rendering ANSImage:", err) - ch <- renderData{row: row, render: tstring.NewColorTString("ERROR", tcell.ColorRed)} + if err != nil { + debug.Print("Panic rendering ANSImage:", err) + ch <- renderData{row: row, render: tstring.NewColorTString("ERROR", tcell.ColorRed)} + } }() str := make(tstring.TString, ai.w) for x := 0; x < ai.w; x++ { |