From e4e7b29d09751195f369851eb0cea5fd6178ab16 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Sat, 31 Mar 2018 15:24:02 -0300 Subject: Fix incorrect usage of as_ptr --- src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 0bc0f6d..617563a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -663,8 +663,10 @@ impl<'a> EnsureValidContext<'a> { pub fn command(self, cmd: &str) { // this was a mistake but oh well let ph = self.ph.ph; + // need to put this in a more permanent position than temporaries + let cmd = CString::new(cmd).unwrap(); unsafe { - ((*ph).hexchat_command)(ph, CString::new(cmd).unwrap().as_ptr()) + ((*ph).hexchat_command)(ph, cmd.as_ptr()) } } -- cgit 1.4.1