catch bad NAT command implementations at runtime

This commit is contained in:
2022-09-08 05:00:55 +00:00
parent dfd4807b80
commit 599b39370b
2 changed files with 17 additions and 4 deletions

View File

@@ -136,9 +136,16 @@
(if (hasComponent e Connections)
(withWritableComponents archive e [conn Connections]
(doFor e2 entriesToConnect (dictSet conn e2.id 1)))
(addComponent archive e Connections (for e2 entriesToConnect =>e2.id 1))))
(addComponent archive e Connections (for e2 entriesToConnect =>e2.id 1)))
)
(function removeConnections [:nat.Archive archive :nat.Entry e :Array<Entry> entriesToRemove]
(when (hasComponent e Connections)
(withWritableComponents archive e [conn Connections]
(doFor e2 entriesToRemove (conn.remove e2.id)))))
(doFor e2 entriesToRemove (conn.remove e2.id))))
e)
(function isEntry [o]
(let [fields (Reflect.fields o)]
(and (= fields.length 3)
(apply and (for f ["id" "components" "files"] (contains fields f))))))