Skip to content

Commit

Permalink
Abort on ID counter overflow (#2078)
Browse files Browse the repository at this point in the history
  • Loading branch information
marc0246 authored Nov 3, 2022
1 parent 99f5ec6 commit 4227629
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vulkano/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
})
}
}

Expand Down

0 comments on commit 4227629

Please # to comment.