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.
This commit is contained in:
Oliver Eyton-Williams
2020-09-21 19:53:08 +02:00
committed by Mrugesh Mohapatra
parent b5784037bb
commit dd7fba4558

View File

@ -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