Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
fix: better error handling when not expected input
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelKohler committed Jun 10, 2020
1 parent 845c61c commit a692731
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web/src/components/pages/rejected.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Rejected extends React.Component {
<p>No rejected sentences found!</p>
)}

{ Object.keys(rejectedSentences).map((language) => (
{ Array.isArray(rejectedSentences) && Object.keys(rejectedSentences).map((language) => (
<section key={'section-' + language}>
<h2 key={language}>{language}</h2>

Expand Down
4 changes: 2 additions & 2 deletions web/src/components/review-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ export default class ReviewForm extends React.Component {
} = this.props;

const {
sentences,
sentences = [],
} = this.state;

if (sentences.length < 1) {
if (!Array.isArray(sentences) || sentences.length < 1) {
return <h2>nothing to review</h2>;
}

Expand Down

0 comments on commit a692731

Please sign in to comment.