# HG changeset patch # User Steve Losh # Date 1286937316 14400 # Node ID b017e692102a3c6c6095f56589d2db9c2280be92 # Parent 3bf27b8bd6c2448228f8addd9888d40e088636c3 Add a sanity check in case someone closes the preview window. diff -r 3bf27b8bd6c2 -r b017e692102a plugin/gundo.vim --- 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__"