Skip to content

Commit

Permalink
fixup! feat: catch memory out in solvers
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjabs committed Apr 18, 2024
1 parent dac1131 commit fdad9ad
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cadical/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ unsafe impl Send for CaDiCaL<'_, '_> {}

impl Default for CaDiCaL<'_, '_> {
fn default() -> Self {
let handle = unsafe { ffi::ccadical_init() };
if handle.is_null() {
panic!("not enough memory to initialize CaDiCaL solver")
}
let solver = Self {
handle: unsafe { ffi::ccadical_init() },
state: Default::default(),
Expand Down

0 comments on commit fdad9ad

Please sign in to comment.