Add check for non-existent buffer
This commit is contained in:
parent
15515e6643
commit
cb66c07a5f
|
@ -77,8 +77,8 @@ pub fn handler(vm: &mut Vm) {
|
||||||
buffer_id => {
|
buffer_id => {
|
||||||
let mut buffs = IPC_BUFFERS.lock();
|
let mut buffs = IPC_BUFFERS.lock();
|
||||||
|
|
||||||
let mut buff = buffs.get_mut(&buffer_id).unwrap();
|
match buffs.get_mut(&buffer_id) {
|
||||||
|
Some(buff) => {
|
||||||
let mut msg_vec = vec![];
|
let mut msg_vec = vec![];
|
||||||
|
|
||||||
for x in 0..(length as isize) {
|
for x in 0..(length as isize) {
|
||||||
|
@ -91,6 +91,9 @@ pub fn handler(vm: &mut Vm) {
|
||||||
"Message {:?} has been sent to Buffer({})",
|
"Message {:?} has been sent to Buffer({})",
|
||||||
msg_vec, buffer_id
|
msg_vec, buffer_id
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
None => log::error!("Access of non-existent buffer")
|
||||||
|
}
|
||||||
drop(buffs);
|
drop(buffs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ fn main(){
|
||||||
std::Trace("Trace Deez");
|
std::Trace("Trace Deez");
|
||||||
|
|
||||||
std::ipc_send(2, 0, 0);
|
std::ipc_send(2, 0, 0);
|
||||||
|
std::ipc_send(3, 0, 0);
|
||||||
|
|
||||||
tx();
|
tx();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue