Use bufloaded() instead of bufname() as a sanity check.
    
        | author | 
        Steve Losh <steve@stevelosh.com> | 
    
    
        | date | 
        Fri, 29 Oct 2010 09:47:46 -0400 | 
    
    
    
        | parents | 
        903d37063c3d 
 | 
    
    
        | children | 
        692cf7ed4c3b
 | 
    
    
        | branches/tags | 
        (none) | 
    
    
        | files | 
        plugin/gundo.vim  | 
    
Changes
    
--- a/plugin/gundo.vim	Thu Oct 28 20:42:03 2010 -0400
+++ b/plugin/gundo.vim	Fri Oct 29 09:47:46 2010 -0400
@@ -397,8 +397,7 @@
     '''
     b = int(vim.eval('g:gundo_target_n'))
 
-    n = vim.eval('bufname(%d)' % b)
-    if not n:
+    if not vim.eval('bufloaded(%d)' % b):
         vim.command('echo "%s"' % (MISSING_BUFFER % b))
         return False