Fix segfault on config load error

This commit is contained in:
Přemysl Eric Janouch 2016-01-20 10:38:52 +01:00 committed by Premysl Janouch
parent e0aa42fb99
commit d6d53a4e70

View File

@ -3049,6 +3049,11 @@ main (int argc, char *argv[])
char *endpoint = NULL;
parse_program_arguments (&g_ctx, argc, argv, &origin, &endpoint);
g_ctx.input = input_new ();
g_ctx.input->user_data = &g_ctx;
g_ctx.input->on_input = process_input;
g_ctx.input->on_run_editor = run_editor;
init_colors (&g_ctx);
load_configuration (&g_ctx);
@ -3110,11 +3115,6 @@ main (int argc, char *argv[])
data_home = xstrdup_printf ("%s/.local/share", home);
}
g_ctx.input = input_new ();
g_ctx.input->user_data = &g_ctx;
g_ctx.input->on_input = process_input;
g_ctx.input->on_run_editor = run_editor;
char *history_path =
xstrdup_printf ("%s/" PROGRAM_NAME "/history", data_home);
(void) g_ctx.input->vtable->load_history (g_ctx.input, history_path, NULL);