changeset 1383:73762e14ee98

typecheck on applyPatch Ignore-this: 74f1fbbbc338b377b466aac6e477f27b
author Drew Perttula <drewp@bigasterisk.com>
date Thu, 09 Jun 2016 05:15:16 +0000
parents b4d81ecf055c
children 6fd81bd4b4a7
files light9/web/graph.coffee
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/light9/web/graph.coffee	Thu Jun 09 05:13:32 2016 +0000
+++ b/light9/web/graph.coffee	Thu Jun 09 05:15:16 2016 +0000
@@ -162,6 +162,8 @@
     [q.subject, q.predicate, q.object, q.graph] for q in @graph.find()
 
   applyAndSendPatch: (patch) ->
+    if !Array.isArray(patch.addQuads) || !Array.isArray(patch.delQuads)
+      throw new Error("corrupt patch: #{patch}")
     @_applyPatch(patch)
     @_client.sendPatch(patch) if @_client