mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-06 09:44:21 +01:00
Fix bug: op_vopen should replace cursor slot, not add new one
This commit is contained in:
@@ -998,7 +998,9 @@ pub fn op_vopen(
|
||||
state
|
||||
.cursors
|
||||
.borrow_mut()
|
||||
.insert(*cursor_id, Some(Cursor::Virtual(cursor)));
|
||||
.get_mut(*cursor_id)
|
||||
.unwrap_or_else(|| panic!("cursor id {} out of bounds", *cursor_id))
|
||||
.replace(Cursor::Virtual(cursor));
|
||||
state.pc += 1;
|
||||
Ok(InsnFunctionStepResult::Step)
|
||||
}
|
||||
|
||||
@@ -349,9 +349,9 @@ impl ProgramState {
|
||||
let cursors = self.cursors.borrow_mut();
|
||||
std::cell::RefMut::map(cursors, |c| {
|
||||
c.get_mut(cursor_id)
|
||||
.expect("cursor id out of bounds")
|
||||
.unwrap_or_else(|| panic!("cursor id {} out of bounds", cursor_id))
|
||||
.as_mut()
|
||||
.expect("cursor not allocated")
|
||||
.unwrap_or_else(|| panic!("cursor id {} is None", cursor_id))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user