diff options
author | Simon THOBY <git@nightmared.fr> | 2021-10-27 19:54:58 +0200 |
---|---|---|
committer | Simon THOBY <git@nightmared.fr> | 2021-11-02 22:18:12 +0100 |
commit | 0156ef5a8b0bdc8e07b8ac12e4c99d5047f1c9cc (patch) | |
tree | 4425a8a540771fc09772f03e214516e934abea94 /rustables/src/table.rs | |
parent | 7f7b2c3af6e6f7a596a85ada823408bdd0b02118 (diff) |
fix: retrieving the name of a table or a chain cannot fail
Diffstat (limited to 'rustables/src/table.rs')
-rw-r--r-- | rustables/src/table.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/rustables/src/table.rs b/rustables/src/table.rs index 53a967f..7cc475f 100644 --- a/rustables/src/table.rs +++ b/rustables/src/table.rs @@ -35,13 +35,13 @@ impl Table { } /// Returns the name of this table. - pub fn get_name(&self) -> Option<&CStr> { + pub fn get_name(&self) -> &CStr { unsafe { let ptr = sys::nftnl_table_get_str(self.table, sys::NFTNL_TABLE_NAME as u16); - if !ptr.is_null() { - Some(CStr::from_ptr(ptr)) + if ptr.is_null() { + panic!("Impossible situation: retrieving the name of a chain failed") } else { - None + CStr::from_ptr(ptr) } } } |