Skip to content

Commit

Permalink
fix null pointer bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Gil Teitelbaum committed Sep 9, 2020
1 parent def75fe commit 91be2eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/movies.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Movies extends Component {

if (movieSearchName.trim() === '')
errors.movieSearchName = "Name of movie is required";
if (movieYear.trim().length > 0 && isNaN(parseInt(movieYear.trim()))) {
if (movieYear && movieYear.trim().length > 0 && isNaN(parseInt(movieYear.trim()))) {
errors.movieYear = "Year is invalid";
}
return errors;
Expand Down

0 comments on commit 91be2eb

Please sign in to comment.