bluetooth: fix undef errors

Filter devices to ensure they have props (idk why but sometimes they just dont have props)
This commit is contained in:
2 * r + 2 * t 2025-05-01 12:38:16 +10:00
parent d52112f25e
commit 8404771805

View file

@ -40,7 +40,7 @@ Singleton {
command: ["fish", "-c", `for a in (bluetoothctl devices | cut -d ' ' -f 2); bluetoothctl info $a | jq -R 'reduce (inputs / ":") as [$key, $value] ({}; .[$key | ltrimstr("\t")] = ($value | ltrimstr(" ")))' | jq -c --arg addr $a '.Address = $addr'; end | jq -sc`]
stdout: SplitParser {
onRead: data => {
const devices = JSON.parse(data);
const devices = JSON.parse(data).filter(d => d.name);
const rDevices = root.devices;
const len = rDevices.length;