From d6d53a4e708696fd7ca1c951565b9d7b19b285b8 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Wed, 20 Jan 2016 10:38:52 +0100 Subject: Fix segfault on config load error --- json-rpc-shell.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/json-rpc-shell.c b/json-rpc-shell.c index 8bf50bd..a76ac1a 100644 --- a/json-rpc-shell.c +++ b/json-rpc-shell.c @@ -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); -- cgit v1.2.3-70-g09d2