Merge branch '2858_mcview_html_segfault'

* 2858_mcview_html_segfault:
  Ticket #2858: segfault when viewing HTML files with "mc -v".
This commit is contained in:
Andrew Borodin 2012-07-31 14:24:54 +04:00
commit 23ad3ecda1
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