0.2.5 fix registered/unregistered check
This commit is contained in:
parent
b9f4c3ce81
commit
4c60c60229
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "hexchat-plugin"
|
name = "hexchat-plugin"
|
||||||
version = "0.2.4"
|
version = "0.2.5"
|
||||||
authors = ["SoniEx2 <endermoneymod@gmail.com>"]
|
authors = ["SoniEx2 <endermoneymod@gmail.com>"]
|
||||||
description = "Lets you write HexChat plugins in Rust"
|
description = "Lets you write HexChat plugins in Rust"
|
||||||
license = "AGPL-3.0+"
|
license = "AGPL-3.0+"
|
||||||
|
|
|
@ -434,9 +434,10 @@ impl PluginHandle {
|
||||||
unsafe {
|
unsafe {
|
||||||
let info = self.info;
|
let info = self.info;
|
||||||
if !(*info.name).is_null() || !(*info.desc).is_null() || !(*info.vers).is_null() {
|
if !(*info.name).is_null() || !(*info.desc).is_null() || !(*info.vers).is_null() {
|
||||||
|
std::str::from_utf8_unchecked(CStr::from_ptr(*info.name).to_bytes())
|
||||||
|
} else {
|
||||||
panic!("Attempt to get the name of a plugin that was not yet registered.");
|
panic!("Attempt to get the name of a plugin that was not yet registered.");
|
||||||
}
|
}
|
||||||
std::str::from_utf8_unchecked(CStr::from_ptr(*info.name).to_bytes())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,9 +450,10 @@ impl PluginHandle {
|
||||||
unsafe {
|
unsafe {
|
||||||
let info = self.info;
|
let info = self.info;
|
||||||
if !(*info.name).is_null() || !(*info.desc).is_null() || !(*info.vers).is_null() {
|
if !(*info.name).is_null() || !(*info.desc).is_null() || !(*info.vers).is_null() {
|
||||||
|
std::str::from_utf8_unchecked(CStr::from_ptr(*info.desc).to_bytes())
|
||||||
|
} else {
|
||||||
panic!("Attempt to get the description of a plugin that was not yet registered.");
|
panic!("Attempt to get the description of a plugin that was not yet registered.");
|
||||||
}
|
}
|
||||||
std::str::from_utf8_unchecked(CStr::from_ptr(*info.desc).to_bytes())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,9 +466,10 @@ impl PluginHandle {
|
||||||
unsafe {
|
unsafe {
|
||||||
let info = self.info;
|
let info = self.info;
|
||||||
if !(*info.name).is_null() || !(*info.desc).is_null() || !(*info.vers).is_null() {
|
if !(*info.name).is_null() || !(*info.desc).is_null() || !(*info.vers).is_null() {
|
||||||
|
std::str::from_utf8_unchecked(CStr::from_ptr(*info.vers).to_bytes())
|
||||||
|
} else {
|
||||||
panic!("Attempt to get the version of a plugin that was not yet registered.");
|
panic!("Attempt to get the version of a plugin that was not yet registered.");
|
||||||
}
|
}
|
||||||
std::str::from_utf8_unchecked(CStr::from_ptr(*info.vers).to_bytes())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue