Skip to content

Commit

Permalink
Merge pull request #382 from richarddd/userdata-fix
Browse files Browse the repository at this point in the history
Only increment userdata count if we actually have it
  • Loading branch information
DelSkayn authored Nov 11, 2024
2 parents f52c84a + 532e858 commit c252171
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/runtime/userdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ impl UserDataMap {

pub fn get<'js, U: UserData<'js>>(&self) -> Option<UserDataGuard<U>> {
let id = TypeId::of::<U::Static>();
self.count.set(self.count.get() + 1);
unsafe { (*self.map.get()).get(&id) }.map(|x| {
self.count.set(self.count.get() + 1);
let u = x
.downcast_ref()
.expect("type confusion! userdata not stored under the right type id");
Expand Down

0 comments on commit c252171

Please sign in to comment.