Skip to content

Commit

Permalink
fix: prevent undefined excluded areas from blowing up app
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaRamirez committed Mar 5, 2023
1 parent de1520e commit f2eccca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/components/DataEditor/DataEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ const isValidJSON = (data: string): boolean => {
}
};



// This is to handle very weird/rare edge cases where data
// can be parsed, but then in turn has to be "double-parsed"
const handleExceptions = (data) => {
Expand Down Expand Up @@ -247,7 +245,8 @@ export class DataEditorBase extends React.Component<DataEditorProps, DataEditorS
const override = this.state.overrideImport;
const data = handleExceptions(JSON.parse(this.state.data));
const nuz = this.props.state;
const safeguards = { customTypes: [], customMoveMap: [], stats: [] };
// @NOTE this prevents previously undefined states from blowing up the app
const safeguards = { customTypes: [], customMoveMap: [], stats: [], excludedAreas: [] };
if (!Array.isArray(data.customMoveMap)) {
noop();
} else {
Expand Down
4 changes: 4 additions & 0 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ const migrations = {
},
},
}),
'1.15.1': (state: State) => ({
...state,
excludedAreas: [],
})
};

const config = {
Expand Down

0 comments on commit f2eccca

Please sign in to comment.