From 0e50a15c2b09c00692cdebf2f492d5a6dc1e7299 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Sun, 24 Apr 2022 15:17:32 -0300 Subject: Safeguard send_modes --- src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 1e8712e..0ed40e2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1371,6 +1371,12 @@ impl<'a, 'ph: 'a> ValidContext<'a, 'ph> { ph_call!(hexchat_send_modes(ph, arr.as_mut_ptr(), arr.len() as c_int, mpl as c_int, sign as c_char, mode as c_char)); } + // some hexchat forks may invalidate the context here. + // just pretend everything is fine and don't bump the major version. + if !self.set_context(&self.get_context()) { + let context = self.ph.find_valid_context().unwrap(); + if !self.set_context(&context) { panic!(); } + } } /// Returns a client setting. -- cgit 1.4.1