Removed sn undefined warning (#572)

This commit is contained in:
Olivia Osborn
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 2e7626d181
commit c35776cce5

View File

@@ -39,7 +39,7 @@ export function createMirror(): Mirror {
map: {},
getId(n) {
// if n is not a serialized INode, use -1 as its id.
if (!n.__sn) {
if (!n || !n.__sn) {
return -1;
}
return n.__sn.id;