diff --git a/workspaces/arborist/lib/node.js b/workspaces/arborist/lib/node.js
index c519a7b543d4d..ac47de8fc3000 100644
--- a/workspaces/arborist/lib/node.js
+++ b/workspaces/arborist/lib/node.js
@@ -1113,8 +1113,12 @@ class Node {
     }
 
     // if they're links, they match if the targets match
-    if (this.isLink) {
-      return node.isLink && this.target.matches(node.target)
+    if (node.isLink) {
+      // Linked to nothing, cannot matches
+      if (!this.target || !node.target) {
+        return false;
+      }
+      return this.target.matches(node.target);
     }
 
     // if they're two project root nodes, they're different if the paths differ
diff --git a/workspaces/arborist/test/node.js b/workspaces/arborist/test/node.js
index f5090dc2def5a..e5fc72e4a1d66 100644
--- a/workspaces/arborist/test/node.js
+++ b/workspaces/arborist/test/node.js
@@ -8,6 +8,7 @@ const { resolve } = require('node:path')
 const treeCheck = require('../lib/tree-check.js')
 
 const { normalizePath, normalizePaths } = require('./fixtures/utils.js')
+const { realpath } = require('node:fs')
 
 t.cleanSnapshot = str =>
   str.split(process.cwd()).join('{CWD}')
@@ -1548,6 +1549,13 @@ t.test('detect that two nodes are the same thing', async t => {
     const b = new Node({ parent: a, pkg: pkgb })
     check(a, b, false, 'name/version mismatch, if no resolved/integrity')
   }
+
+  {
+    const root = new Node({ path: '/x' })
+    const a = new Link({ root, path: '/a', realpath: '/a', target: null })
+    const b = new Link({ root, path: '/b', realpath: '/b', target: null })
+    check(a, b, false, 'links does not match if target to null')
+  }
 })
 
 t.test('node.satisfies(requested)', t => {