b017e692102a

Add a sanity check in case someone closes the preview window.
[view raw] [browse files]
author Steve Losh <steve@dwaiter.com>
date Tue, 12 Oct 2010 22:35:16 -0400
parents 3bf27b8bd6c2
children 7100a024df57
branches/tags (none)
files plugin/gundo.vim

Changes

--- a/plugin/gundo.vim	Tue Oct 12 22:33:06 2010 -0400
+++ b/plugin/gundo.vim	Tue Oct 12 22:35:16 2010 -0400
@@ -100,10 +100,11 @@
 
 function! s:GundoToggle()
     if expand('%') == "__Gundo__"
-        " TODO: Add some sanity checks here.
         quit
-        exe bufwinnr(bufnr('__Gundo_Preview__')) . "wincmd w"
-        quit
+        if bufwinnr(bufnr('__Gundo_Preview__')) != -1
+            exe bufwinnr(bufnr('__Gundo_Preview__')) . "wincmd w"
+            quit
+        endif
         exe bufwinnr(g:gundo_target_n) . "wincmd w"
     else
         if expand('%') != "__Gundo_Preview__"