mirror of
https://github.com/urbit/ares.git
synced 2024-11-23 00:25:49 +03:00
nock: fix slot access bug
This commit is contained in:
parent
b78ccf25e5
commit
6ef60d8209
@ -661,7 +661,7 @@ impl private::RawSlots for Cell {
|
||||
fn raw_slot(&self, axis: &BitSlice<u64, Lsb0>) -> Result<Noun> {
|
||||
let mut noun: Noun = self.as_noun();
|
||||
// Panic because all of the logic to guard against this is in Noun::RawSlots, Noun::Slots
|
||||
let mut cursor = axis.last_one().expect("raw_slow somehow by-passed 0 check");
|
||||
let mut cursor = axis.last_one().expect("raw_slot somehow by-passed 0 check");
|
||||
|
||||
while cursor != 0 {
|
||||
cursor -= 1;
|
||||
@ -1261,7 +1261,10 @@ pub trait Slots: private::RawSlots {
|
||||
* Retrieve component Noun at axis given as Atom, or fail with descriptive error
|
||||
*/
|
||||
fn slot_atom(&self, atom: Atom) -> Result<Noun> {
|
||||
self.raw_slot(atom.as_bitslice())
|
||||
match atom.as_either() {
|
||||
Left(direct) => self.slot(direct.data()),
|
||||
Right(indirect) => self.raw_slot(indirect.as_bitslice()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user