diff --git a/lib/json0.js b/lib/json0.js index 9f538ee..abea8ff 100644 --- a/lib/json0.js +++ b/lib/json0.js @@ -70,6 +70,9 @@ json.invertComponent = function(c) { // handle subtype ops if (c.t && subtypes[c.t]) { + if (typeof subtypes[c.t].invert !== 'function') { + throw new Error("Subtype '" + c.t + "' is not invertible"); + } c_.t = c.t; c_.o = subtypes[c.t].invert(c.o); }