Skip to content

Commit

Permalink
Fixed Bug in Bus.js
Browse files Browse the repository at this point in the history
Check for empty object before null check was causing an error
  • Loading branch information
tarun-menta committed Jan 15, 2021
1 parent 98686ba commit ec694c6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pages/Bus.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ function Bus({ schedule }) {
);
};

if (Object.keys(schedule).length === 0) {
return <h1>Loading...</h1>;
if (schedule === null || schedule === undefined) {
return <h1>Error</h1>;
}

if (schedule === null) {
return <h1>Error</h1>;
if (Object.keys(schedule).length === 0) {
return <h1>Loading...</h1>;
}

return (
Expand Down

0 comments on commit ec694c6

Please sign in to comment.