From a59d2f6a65f1a607ac7ed482315d2111358b2d7a Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Sun, 29 Jun 2025 17:48:09 +0200 Subject: [PATCH] More null checks --- tree/.local/nu/tailscale.nu | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tree/.local/nu/tailscale.nu b/tree/.local/nu/tailscale.nu index 36923f6..3f15f4a 100644 --- a/tree/.local/nu/tailscale.nu +++ b/tree/.local/nu/tailscale.nu @@ -31,10 +31,15 @@ def "tailscale peer" [ }) if $hostname == null { - $peers - } else { - $peers | where host == $hostname | first | get $get_field + return $peers } + + let peers = ($peers | where host == $hostname) + if ($peers | is-empty) { + return null + } + + $peers | first | get $get_field } # SSH to a tailscale peer