[geany/geany] 66b28e: Merge pull request #3153 from eht16/vte_handle_null_command

Enrico Tröger git-noreply at geany.org
Sun May 22 12:54:08 UTC 2022


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   GitHub <noreply at github.com>
Date:        Sun, 22 May 2022 12:54:08 UTC
Commit:      66b28eb01a1e8e839780095e3eb5d6706daa8eb4
             https://github.com/geany/geany/commit/66b28eb01a1e8e839780095e3eb5d6706daa8eb4

Log Message:
-----------
Merge pull request #3153 from eht16/vte_handle_null_command

VTE: Fix crash when "send_cmd_prefix" is NULL


Modified Paths:
--------------
    src/vte.c

Modified: src/vte.c
5 lines changed, 4 insertions(+), 1 deletions(-)
===================================================================
@@ -806,6 +806,8 @@ static GtkWidget *vte_create_popup_menu(void)
  * on the prompt). */
 gboolean vte_send_cmd(const gchar *cmd)
 {
+	g_return_val_if_fail(cmd != NULL, FALSE);
+
 	if (clean)
 	{
 		vf->vte_terminal_feed_child(VTE_TERMINAL(vte_config.vte), cmd, strlen(cmd));
@@ -879,7 +881,8 @@ void vte_cwd(const gchar *filename, gboolean force)
 		{
 			/* use g_shell_quote to avoid problems with spaces, '!' or something else in path */
 			gchar *quoted_path = g_shell_quote(path);
-			gchar *cmd = g_strconcat(vte_config.send_cmd_prefix, "cd ", quoted_path, "\n", NULL);
+			const gchar *cmd_prefix = vte_config.send_cmd_prefix ? vte_config.send_cmd_prefix : "";
+			gchar *cmd = g_strconcat(cmd_prefix, "cd ", quoted_path, "\n", NULL);
 			if (! vte_send_cmd(cmd))
 			{
 				const gchar *msg = _("Directory not changed because the terminal may contain some input (press Ctrl+C or Enter to clear it).");



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list