Skip to content

Commit

Permalink
VTE: Fix crash when "send_cmd_prefix" is NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
eht16 committed Apr 7, 2022
1 parent 378e5e8 commit fc825cb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/vte.c
Expand Up @@ -802,7 +802,7 @@ static GtkWidget *vte_create_popup_menu(void)
* on the prompt). */
gboolean vte_send_cmd(const gchar *cmd)
{
if (clean)
if (clean && cmd)
{
vf->vte_terminal_feed_child(VTE_TERMINAL(vc->vte), cmd, strlen(cmd));
set_clean(TRUE); /* vte_terminal_feed_child() also marks the vte as not clean */
Expand Down Expand Up @@ -875,7 +875,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(vc->send_cmd_prefix, "cd ", quoted_path, "\n", NULL);
const gchar *cmd_prefix = vc->send_cmd_prefix ? vc->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).");
Expand Down

0 comments on commit fc825cb

Please sign in to comment.