Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.

Commit 695995b

Browse files
dorezyukDima Dorezyuk
andauthored
Fix optional interface handling in Rust (#238)
Signed-off-by: Dima Dorezyuk <ddo@qwello.eu> Co-authored-by: Dima Dorezyuk <ddo@qwello.eu>
1 parent 84395f2 commit 695995b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

everestrs/everestrs/src/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,17 @@ impl Runtime {
585585

586586
// Subscribe to all variables that might be of interest.
587587
for (implementation_id, requires) in manifest.requires {
588+
let connection = connections.get(&implementation_id).cloned().unwrap_or(0);
588589
let interface_s = self.cpp_module.get_interface(&requires.interface);
590+
// EVerest framework may return null if an interface is not used in
591+
// the config (the connection is then 0).
592+
if interface_s.as_bytes() == b"null" && connection == 0 {
593+
debug!("Skipping the interface {implementation_id}");
594+
continue;
595+
}
589596
let interface: schema::InterfaceFromEverest = interface_s.deserialize();
590597

591-
for i in 0usize..connections.get(&implementation_id).cloned().unwrap_or(0) {
598+
for i in 0usize..connection {
592599
for (name, _) in interface.vars.iter() {
593600
self.cpp_module.as_ref().unwrap().subscribe_variable(
594601
self,

0 commit comments

Comments
 (0)