Skip to content

Commit 4b63376

Browse files
committed
remove panic
1 parent 9121540 commit 4b63376

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/traits.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ where
178178
}
179179

180180
fn get_with_id(&self, at: I) -> Option<&T> {
181-
self.0.get(at.try_into().unwrap())
181+
self.0.get(at.try_into().ok()?)
182182
}
183183

184184
fn get_with_size_type(&self, at: crate::SizeType) -> Option<&T> {
185-
self.0.get(usize::try_from(at).unwrap())
185+
self.0.get(usize::try_from(at).ok()?)
186186
}
187187

188188
fn iter<'a, 'b>(&'a self) -> impl Iterator<Item = &'b T>

0 commit comments

Comments
 (0)