diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2018-06-01 11:25:01 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2018-06-01 11:25:01 -0300 |
commit | 4c60c6022980357640d3e2afcfb29e9d84cddddb (patch) | |
tree | bd8f46dd0efd87947eb247f2cd94e56bb8b927ee /src | |
parent | b9f4c3ce81aacdbdecc1d4fea16a0fa920258d87 (diff) |
0.2.5 fix registered/unregistered check
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs index 1b9ffec..9959dc7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -434,9 +434,10 @@ impl PluginHandle { unsafe { let info = self.info; 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."); } - std::str::from_utf8_unchecked(CStr::from_ptr(*info.name).to_bytes()) } } @@ -449,9 +450,10 @@ impl PluginHandle { unsafe { let info = self.info; 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."); } - std::str::from_utf8_unchecked(CStr::from_ptr(*info.desc).to_bytes()) } } @@ -464,9 +466,10 @@ impl PluginHandle { unsafe { let info = self.info; 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."); } - std::str::from_utf8_unchecked(CStr::from_ptr(*info.vers).to_bytes()) } } |