diff src/optionstr.c @ 31886:b741e5243e58 v9.0.1275

patch 9.0.1275: the code for setting options is too complicated Commit: https://github.com/vim/vim/commit/78012f55faf7444e554c0a97a589d99fa215bea9 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Thu Feb 2 16:34:11 2023 +0000 patch 9.0.1275: the code for setting options is too complicated Problem: The code for setting options is too complicated. Solution: Refactor the do_set() function. (Yegappan Lakshmanan, Lewis Russell, closes #11932)
author Bram Moolenaar <Bram@vim.org>
date Thu, 02 Feb 2023 17:45:05 +0100
parents f5bbf51d65f7
children 82da100c0e45
line wrap: on
line diff
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -680,7 +680,8 @@ did_set_term(int *opt_idx, long_u *free_
 	// Both 'term' and 'ttytype' point to T_NAME, only set the
 	// P_ALLOCED flag on 'term'.
 	*opt_idx = findoption((char_u *)"term");
-	*free_oldval = (get_option_flags(*opt_idx) & P_ALLOCED);
+	if (*opt_idx >= 0)
+	    *free_oldval = (get_option_flags(*opt_idx) & P_ALLOCED);
     }
 
     return errmsg;