From 5d4db78427d80a6b8968b4d6345640e8d9079b12 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Wed, 14 Jun 2023 23:26:30 +0300 Subject: [PATCH] suspend-node: check if the node still exists before suspending it After a timeout, it's possible that something else may have destroyed the node already. This can happen for example with virtual sinks that were created from another process. Fixes: #467 --- src/scripts/suspend-node.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/scripts/suspend-node.lua b/src/scripts/suspend-node.lua index b68d3d08..8b5783b3 100644 --- a/src/scripts/suspend-node.lua +++ b/src/scripts/suspend-node.lua @@ -38,8 +38,11 @@ om:connect("object-added", function (om, node) -- add idle timeout; multiply by 1000, timeout_add() expects ms sources[id] = Core.timeout_add(timeout * 1000, function() -- Suspend the node - Log.info(node, "was idle for a while; suspending ...") - node:send_command("Suspend") + -- but check first if the node still exists + if (node:get_active_features() & Feature.Proxy.BOUND) ~= 0 then + Log.info(node, "was idle for a while; suspending ...") + node:send_command("Suspend") + end -- Unref the source sources[id] = nil