summary refs log tree commit diff stats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2022-04-24 15:17:32 -0300
committerSoniEx2 <endermoneymod@gmail.com>2022-04-24 15:17:32 -0300
commit0e50a15c2b09c00692cdebf2f492d5a6dc1e7299 (patch)
tree5689a756a8f75826ff170698abd47a5e3aa95281 /src/lib.rs
parent22ea3ac066b8c10dab1104a465fc7b182e65b7b2 (diff)
Safeguard send_modes
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs6
1 files changed, 6 insertions, 0 deletions
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.