Skip to content

Commit

Permalink
move argument checking to cconvert
Browse files Browse the repository at this point in the history
Co-authored-by: Valentin Churavy <[email protected]>
  • Loading branch information
Joroks and vchuravy authored Aug 7, 2024
1 parent 59d208b commit 5874369
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/LAMMPS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ mutable struct LMP
end
end

function Base.unsafe_convert(::Type{Ptr{Cvoid}}, lmp::LMP)
function Base.cconvert(::Type{Ptr{Cvoid}}, lmp::LMP)
lmp.handle == C_NULL && error("The LMP object doesn't point to a valid LAMMPS instance! "
* "This is usually caused by calling `LAMMPS.close!` or through serialization and deserialization.")
return lmp.handle
return lmp
end
Base.unsafe_convert(::Type{Ptr{Cvoid}}, lmp::LMP) = lmp.handle

"""
close!(lmp::LMP)
Expand Down

0 comments on commit 5874369

Please sign in to comment.