From a4407668c39a0f5d267007b3f2f3522f5c46eb11 Mon Sep 17 00:00:00 2001 From: Alan Sartorio <47906325+alansartorio@users.noreply.github.com> Date: Thu, 26 Oct 2023 10:10:05 -0300 Subject: [PATCH] Fix crash when starting "All Desktop Audio" without nodes (#69) * Fix #66 * Write '[]' to portsFile instead of using /dev/null --- native/connector/connect-and-monitor.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/native/connector/connect-and-monitor.sh b/native/connector/connect-and-monitor.sh index 8a4e73d..9f78c2f 100755 --- a/native/connector/connect-and-monitor.sh +++ b/native/connector/connect-and-monitor.sh @@ -36,7 +36,11 @@ UtilLog "[connect-and-monitor.sh] [Got Streams] File: $streamsFile" streamIds=`cat "$streamsFile" | jq -c '.[].id' | paste -sd ','` UtilLog "[connect-and-monitor.sh] [Got Stream IDs] IDs: $streamIds" -cat "$fullDumpFile" | jq -c "[ .[] | select(.type == \"PipeWire:Interface:Port\") | select(.info.direction == \"output\") | select(.info.props[\"node.id\"] | contains($streamIds)) ]" > $portsFile +if [[ -n "$streamIds" ]]; then + cat "$fullDumpFile" | jq -c "[ .[] | select(.type == \"PipeWire:Interface:Port\") | select(.info.direction == \"output\") | select(.info.props[\"node.id\"] | contains($streamIds)) ]" > $portsFile +else + echo '[]' > $portsFile +fi UtilLog "[connect-and-monitor.sh] [Got Ports] File: $portsFile" if [[ ! "$targetNodeSerial" -eq "-1" ]]; then