Skip to content

Commit

Permalink
check if parks is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecM33 committed Aug 7, 2024
1 parent c518409 commit 8b65cd5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions modules/gameday-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ module.exports = {
if (numberOfParks <= globals.HOME_RUN_PARKS_MIN || numberOfParks >= globals.HOME_RUN_PARKS_MAX) {
reply += ' - ';
const parks = numberOfParks >= globals.HOME_RUN_PARKS_MAX ? xParks.not : xParks.hr;
for (let i = 0; i < parks.length; i ++) {
reply += parks[i].name + ' (' + parks[i].team_abbrev + ')';
if (i < parks.length - 1) {
reply += ', ';
if (parks) {
for (let i = 0; i < parks.length; i ++) {
reply += parks[i].name + ' (' + parks[i].team_abbrev + ')';
if (i < parks.length - 1) {
reply += ', ';
}
}
}
return reply;
Expand Down

0 comments on commit 8b65cd5

Please sign in to comment.