diff --git a/interface.c b/interface.c index 832cdfc..eb463f6 100644 --- a/interface.c +++ b/interface.c @@ -1708,12 +1708,13 @@ void secret_chat_update_gw (struct tgl_secret_chat *U, unsigned flags) { write_secret_chat_file (); } + if (!binlog_read) { return; } + if ((flags & TGL_UPDATE_REQUESTED) && !disable_auto_accept) { tgl_do_accept_encr_chat_request (U, 0, 0); } if (disable_output && !notify_ev) { return; } - if (!binlog_read) { return; } struct in_ev *ev = notify_ev; diff --git a/mtproto-client.c b/mtproto-client.c index 71bb693..703badc 100644 --- a/mtproto-client.c +++ b/mtproto-client.c @@ -1408,12 +1408,17 @@ void tglmp_regenerate_temp_auth_key (struct tgl_dc *D) { return; } + struct tgl_session *S = D->sessions[0]; tglt_secure_random (&S->session_id, 8); S->seq_no = 0; event_del (S->ev); S->ack_tree = tree_clear_long (S->ack_tree); + + if (D->state != st_authorized) { + return; + } if (S->c) { create_temp_auth_key (S->c); diff --git a/queries.c b/queries.c index c5c30ff..ba32b74 100644 --- a/queries.c +++ b/queries.c @@ -2970,6 +2970,8 @@ void tgl_do_send_accept_encr_chat (struct tgl_secret_chat *E, unsigned char *ran } return; } // Already generated key for this chat + assert (E->g_key); + assert (tgl_state.BN_ctx); unsigned char random_here[256]; tglt_secure_random (random_here, 256); for (i = 0; i < 256; i++) {