From 0156ef5a8b0bdc8e07b8ac12e4c99d5047f1c9cc Mon Sep 17 00:00:00 2001 From: Simon THOBY Date: Wed, 27 Oct 2021 19:54:58 +0200 Subject: fix: retrieving the name of a table or a chain cannot fail --- rustables/src/table.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'rustables/src/table.rs') 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) } } } -- cgit v1.2.3