Skip to content

Commit 6a07ac8

Browse files
authored
fix: avoid accessing properties of empty Example Objects (#10453)
1 parent 36a19fa commit 6a07ac8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/core/components/examples-select-value-retainer.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,11 @@ export default class ExamplesSelectValueRetainer extends React.PureComponent {
187187

188188
const examplesMatchingNewValue = examples.filter(
189189
(example) =>
190-
example.get("value") === newValue ||
191-
// sometimes data is stored as a string (e.g. in Request Bodies), so
192-
// let's check against a stringified version of our example too
193-
stringify(example.get("value")) === newValue
190+
Map.isMap(example) &&
191+
(example.get("value") === newValue ||
192+
// sometimes data is stored as a string (e.g. in Request Bodies), so
193+
// let's check against a stringified version of our example too
194+
stringify(example.get("value")) === newValue)
194195
)
195196

196197
if (examplesMatchingNewValue.size) {

0 commit comments

Comments
 (0)