Ticket #2858: segfault when viewing HTML files with "mc -v".

(expand_format): don't try expand format and return empty line
for modes that are not used formatted variables.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-07-30 10:14:46 +04:00
parent ab05b54337
commit e2f30017a0
1 changed files with 11 additions and 3 deletions

View File

@ -748,8 +748,9 @@ expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
if (c == '%')
return g_strdup ("%");
if (mc_global.mc_run_mode == MC_RUN_FULL)
switch (mc_global.mc_run_mode)
{
case MC_RUN_FULL:
if (g_ascii_islower ((gchar) c))
panel = current_panel;
else
@ -759,12 +760,19 @@ expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
panel = other_panel;
}
fname = g_strdup (panel->dir.list[panel->selected].fname);
}
break;
#ifdef USE_INTERNAL_EDIT
else if (mc_global.mc_run_mode == MC_RUN_EDITOR)
case MC_RUN_EDITOR:
fname = edit_get_file_name (edit_widget);
break;
#endif
default:
/* other modes don't use formats */
return g_strdup ("");
}
if (do_quote)
quote_func = name_quote;
else