From 4227629a4c5b7bd2377d5c178b2052d4716433e7 Mon Sep 17 00:00:00 2001 From: marc0246 <40955683+marc0246@users.noreply.github.com> Date: Thu, 3 Nov 2022 15:24:09 +0100 Subject: [PATCH] Abort on ID counter overflow (#2078) --- vulkano/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vulkano/src/lib.rs b/vulkano/src/lib.rs index 0e51a46f0e..ba2958cedf 100644 --- a/vulkano/src/lib.rs +++ b/vulkano/src/lib.rs @@ -403,7 +403,10 @@ macro_rules! impl_id_counter { static COUNTER: AtomicU64 = AtomicU64::new(1); - NonZeroU64::new(COUNTER.fetch_add(1, Ordering::Relaxed)).expect("ID overflow") + NonZeroU64::new(COUNTER.fetch_add(1, Ordering::Relaxed)).unwrap_or_else(|| { + println!("an ID counter has overflown ...somehow"); + std::process::abort(); + }) } }