From dd7fba4558f5a0c4b2dc35ebd919c22921c0b0df Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Mon, 21 Sep 2020 19:53:08 +0200 Subject: [PATCH] fix(learn): ignore missing editable regions They should never be missing, so that bug should be squashed. However, for now, this gracefully deals with their absence. --- client/src/templates/Challenges/classic/Editor.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/src/templates/Challenges/classic/Editor.js b/client/src/templates/Challenges/classic/Editor.js index 7582cf42d8..954ae710f2 100644 --- a/client/src/templates/Challenges/classic/Editor.js +++ b/client/src/templates/Challenges/classic/Editor.js @@ -201,9 +201,9 @@ class Editor extends Component { ); this.data.model = model; - const editableRegion = [ - ...challengeFiles[fileKey].editableRegionBoundaries - ]; + const editableRegion = challengeFiles[fileKey].editableRegionBoundaries + ? [...challengeFiles[fileKey].editableRegionBoundaries] + : []; if (editableRegion.length === 2) this.decorateForbiddenRanges(editableRegion); @@ -286,9 +286,9 @@ class Editor extends Component { } }); - const editableBoundaries = [ - ...challengeFiles[fileKey].editableRegionBoundaries - ]; + const editableBoundaries = challengeFiles[fileKey].editableRegionBoundaries + ? [...challengeFiles[fileKey].editableRegionBoundaries] + : []; if (editableBoundaries.length === 2) { // TODO: is there a nicer approach/way of organising everything that