diff src/option.c @ 3308:076003f52582 v7.3.421

updated for version 7.3.421 Problem: Get E832 when setting 'undofile' in vimrc and there is a file to be edited on the command line. (Toothpik) Solution: Do not try reading the undo file for a file that wasn't loaded.
author Bram Moolenaar <bram@vim.org>
date Sat, 28 Jan 2012 18:03:35 +0100
parents 320cc46d0eb0
children de050fcc24cf
line wrap: on
line diff
--- a/src/option.c
+++ b/src/option.c
@@ -7527,10 +7527,11 @@ set_bool_option(opt_idx, varp, value, op
 	{
 	    /* When 'undofile' is set globally: for every buffer, otherwise
 	     * only for the current buffer: Try to read in the undofile, if
-	     * one exists and the buffer wasn't changed. */
+	     * one exists and the buffer wasn't changed and the buffer was
+	     * loaded. */
 	    if ((curbuf == save_curbuf
 				|| (opt_flags & OPT_GLOBAL) || opt_flags == 0)
-		    && !curbufIsChanged())
+		    && !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL)
 	    {
 		u_compute_hash(hash);
 		u_read_undo(NULL, hash, curbuf->b_fname);