From 2179ec6d468a081f0f41a3a8699c100fd0d0b0d7 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 21 Apr 2017 11:30:06 -0700 Subject: [PATCH] client: don't crash if can't open gui_rpc_auth.cfg --- client/gui_rpc_server.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/client/gui_rpc_server.cpp b/client/gui_rpc_server.cpp index 96e21a935b..a232712a5a 100644 --- a/client/gui_rpc_server.cpp +++ b/client/gui_rpc_server.cpp @@ -162,13 +162,14 @@ void GUI_RPC_CONN_SET::get_password() { msg_printf(NULL, MSG_USER_ALERT, "Can't open gui_rpc_auth.cfg - fix permissions" ); - } - retval = fputs(password, f); - fclose(f); - if (retval == EOF) { - msg_printf(NULL, MSG_USER_ALERT, - "Can't write gui_rpc_auth.cfg - fix permissions" - ); + } else { + retval = fputs(password, f); + fclose(f); + if (retval == EOF) { + msg_printf(NULL, MSG_USER_ALERT, + "Can't write gui_rpc_auth.cfg - fix permissions" + ); + } } #ifndef _WIN32 // if someone can read the password,