Trap out-of-bounds panic for BLOB's.
This commit is contained in:
parent
5363b0724f
commit
70f4c53854
@ -13,6 +13,7 @@ Bug fixes
|
||||
---------
|
||||
|
||||
* `from_dynamic` now supports deserializing `Option`.
|
||||
* BLOB's no longer panic when accessed with an out-of-bounds index.
|
||||
|
||||
Enhancements
|
||||
------------
|
||||
|
@ -2052,7 +2052,12 @@ impl Engine {
|
||||
index as usize
|
||||
};
|
||||
|
||||
let value = (arr[arr_idx] as INT).into();
|
||||
let value = arr
|
||||
.get(arr_idx)
|
||||
.map(|&v| (v as INT).into())
|
||||
.ok_or_else(|| {
|
||||
Box::new(EvalAltResult::ErrorArrayBounds(arr_len, index, idx_pos))
|
||||
})?;
|
||||
Ok(Target::BlobByte(target, arr_idx, value))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user