From 53a10ddcaf1b38fe1ad80a9b55ea796bcc904b4b Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 24 Feb 2018 20:08:32 +0100
Subject: [PATCH] tweaks: elide an unneeded variable

A shortcut's function must be among the existing ones, otherwise
nano's code is fundamentally broken.
---
 src/prompt.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/prompt.c b/src/prompt.c
index f025c770..c013ed61 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -64,7 +64,6 @@ int do_statusbar_input(bool *finished)
 	static size_t kbinput_len = 0;
 		/* The length of the input buffer. */
 	const sc *shortcut;
-	const subnfunc *f;
 
 	*finished = FALSE;
 
@@ -168,8 +167,7 @@ int do_statusbar_input(bool *finished)
 			/* Handle any other shortcut in the current menu, setting finished
 			 * to TRUE to indicate that we're done after running or trying to
 			 * run its associated function. */
-			f = sctofunc(shortcut);
-			if (f && (!ISSET(VIEW_MODE) || f->viewok))
+			if (!ISSET(VIEW_MODE) || sctofunc(shortcut)->viewok)
 				execute(shortcut);
 			*finished = TRUE;
 		}
-- 
GitLab