From 18bf206e8c1197fd01d4ee6f0e789bd54d1b7f88 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Thu, 15 Dec 2016 16:43:29 +0300 Subject: [PATCH] handle empty folders properly while drawing the ui --- ui.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ui.go b/ui.go index 520be7d..d4cbcc0 100644 --- a/ui.go +++ b/ui.go @@ -535,16 +535,14 @@ func (ui *UI) draw(nav *Nav) { if gOpts.preview { f, err := nav.currFile() - if err != nil { - return - } + if err == nil { + preview := ui.wins[len(ui.wins)-1] - preview := ui.wins[len(ui.wins)-1] - - if f.IsDir() { - preview.printd(ui.dirprev, nav.marks, nav.saves) - } else if f.Mode().IsRegular() { - preview.printr(ui.regprev) + if f.IsDir() { + preview.printd(ui.dirprev, nav.marks, nav.saves) + } else if f.Mode().IsRegular() { + preview.printr(ui.regprev) + } } }