From 91be2eb824ff0f2c66569356d53e4f5ed0a29b74 Mon Sep 17 00:00:00 2001 From: Gil Teitelbaum Date: Wed, 9 Sep 2020 08:50:38 +0300 Subject: [PATCH] fix null pointer bug --- src/components/movies.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/movies.jsx b/src/components/movies.jsx index 20dbfd9..35775b4 100644 --- a/src/components/movies.jsx +++ b/src/components/movies.jsx @@ -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;