Fix crash when receiving unregistered remotes
This commit is contained in:
parent
11bd4ba0dd
commit
32f0171d39
@ -71,6 +71,7 @@ void add_remote_objects(remote_object_t** _remote_objects, uint32_t _num_remote_
|
|||||||
|
|
||||||
void transport_recv_frame(uint8_t from, uint8_t* data, uint16_t size) {
|
void transport_recv_frame(uint8_t from, uint8_t* data, uint16_t size) {
|
||||||
uint8_t id = data[size-1];
|
uint8_t id = data[size-1];
|
||||||
|
if (id < num_remote_objects) {
|
||||||
remote_object_t* obj = remote_objects[id];
|
remote_object_t* obj = remote_objects[id];
|
||||||
uint8_t* start;
|
uint8_t* start;
|
||||||
if (obj->object_type == MASTER_TO_ALL_SLAVES) {
|
if (obj->object_type == MASTER_TO_ALL_SLAVES) {
|
||||||
@ -87,6 +88,7 @@ void transport_recv_frame(uint8_t from, uint8_t* data, uint16_t size) {
|
|||||||
void* ptr = triple_buffer_begin_write_internal(obj->object_size, tb);
|
void* ptr = triple_buffer_begin_write_internal(obj->object_size, tb);
|
||||||
memcpy(ptr, data, size -1);
|
memcpy(ptr, data, size -1);
|
||||||
triple_buffer_end_write_internal(tb);
|
triple_buffer_end_write_internal(tb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_transport(void) {
|
void update_transport(void) {
|
||||||
|
Loading…
Reference in New Issue
Block a user