aboutsummaryrefslogtreecommitdiff
path: root/json-rpc-shell.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-01-20 10:38:52 +0100
committerPremysl Janouch <pjan06@autokelly.cz>2016-01-20 10:39:46 +0100
commitd6d53a4e708696fd7ca1c951565b9d7b19b285b8 (patch)
tree86e2ec9c36bf472bd91fa7c95293e27c6ca34fe3 /json-rpc-shell.c
parente0aa42fb994b4c0b74f7d5a34d80cf4586151721 (diff)
downloadjson-rpc-shell-d6d53a4e708696fd7ca1c951565b9d7b19b285b8.tar.gz
json-rpc-shell-d6d53a4e708696fd7ca1c951565b9d7b19b285b8.tar.xz
json-rpc-shell-d6d53a4e708696fd7ca1c951565b9d7b19b285b8.zip
Fix segfault on config load error
Diffstat (limited to 'json-rpc-shell.c')
-rw-r--r--json-rpc-shell.c10
1 files 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);