From 5a9d618a625a13ae88a7a4a39d33db03cd76ce0f Mon Sep 17 00:00:00 2001 From: Karishma Chadha Date: Mon, 13 Aug 2018 14:28:13 -0400 Subject: [PATCH] fix(sb3_definitions): fix comment position validation A comment's x and y can be null. This will occur if a project is imported from 2.0, a sprite that is not currently selected has comments, and that project is immediately saved in 3.0 without switching to the other sprite that has comments. --- lib/sb3_definitions.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/sb3_definitions.json b/lib/sb3_definitions.json index ff4548c..2cff9ef 100644 --- a/lib/sb3_definitions.json +++ b/lib/sb3_definitions.json @@ -9,6 +9,12 @@ {"type": "null"} ] }, + "optionalNumber": { + "oneOf": [ + {"type": "number"}, + {"type": "null"} + ] + }, "boolOrOptBoolString": { "oneOf": [ {"type": "string", @@ -294,8 +300,8 @@ "maxLength": 8000 }, "minimized": {"type": "boolean"}, - "x": {"type": "number"}, - "y": {"type": "number"}, + "x": {"$ref": "#/definitions/optionalNumber"}, + "y": {"$ref": "#/definitions/optionalNumber"}, "width": {"type": "number"}, "height": {"type": "number"} },