Skip to content

Commit

Permalink
refactor(cursor): make Cursor::new pub(crate) and check for nullptr o…
Browse files Browse the repository at this point in the history
…n `World::cursor_id`
  • Loading branch information
Indra-db committed Dec 22, 2024
1 parent 5d45f70 commit 6884aca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion flecs_ecs/src/addons/meta/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct Cursor<'a> {
impl<'a> Cursor<'a> {
/// Creates a new cursor instance
#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn new(
pub(crate) fn new(
world: impl WorldProvider<'a>,
type_id: impl Into<Entity>,
ptr: *mut std::ffi::c_void,
Expand Down
4 changes: 4 additions & 0 deletions flecs_ecs/src/addons/meta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ impl World {
///
/// * C++ API: `world::cursor`
pub fn cursor_id(&self, type_id: impl Into<Entity>, ptr: *mut c_void) -> Cursor {
if ptr.is_null() {
panic!("ptr is null");
}

Cursor::new(self, type_id, ptr)
}

Expand Down

0 comments on commit 6884aca

Please sign in to comment.