summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-09-29 02:53:05 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-09-29 02:53:05 +0900
commit957c12e7d702a30c925b6d9c02b6bd07acdaa3ff (patch)
tree97fb938f0fbadd37af3d76613e94b0a1d16737ca /src
parent3b5ae0f8a2ccdbad2656109c44ec7fb7322c7a67 (diff)
downloadfzf-957c12e7d702a30c925b6d9c02b6bd07acdaa3ff.tar.gz
Fix SEGV when trying to render preview but the window is closed
Close #677
Diffstat (limited to 'src')
-rw-r--r--src/terminal.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/terminal.go b/src/terminal.go
index 14dcd28f..02fe7317 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -796,6 +796,9 @@ func numLinesMax(str string, max int) int {
}
func (t *Terminal) printPreview() {
+ if !t.isPreviewEnabled() {
+ return
+ }
t.pwindow.Erase()
skip := t.previewer.offset
extractColor(t.previewer.text, nil, func(str string, ansi *ansiState) bool {
@@ -839,9 +842,7 @@ func (t *Terminal) printAll() {
t.printPrompt()
t.printInfo()
t.printHeader()
- if t.isPreviewEnabled() {
- t.printPreview()
- }
+ t.printPreview()
}
func (t *Terminal) refresh() {