Skip to content

Commit

Permalink
better handling for dummy data on player roster
Browse files Browse the repository at this point in the history
  • Loading branch information
NB10328 authored and NB10328 committed Apr 16, 2021
1 parent 332926e commit c0dab1e
Show file tree
Hide file tree
Showing 5 changed files with 18,660 additions and 13,304 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swgoh-api-swgohhelp",
"version": "0.3.0",
"version": "0.3.1",
"description": "SWGoH helper API for swgoh.help",
"main": "index.js",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion swgohhelp-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ class SwgohHelpApi {
* @returns {Unit} The unit from player roster.
*/
static getPlayerUnitFromUnits(player, searchName) {
return player.roster.find(unit => unit.nameKey.toLowerCase() == searchName.toLowerCase());
return player.roster.filter(unit => unit.nameKey != null).find(unit => unit.nameKey.toLowerCase() == searchName.toLowerCase());
}

/**
Expand Down
Loading

0 comments on commit c0dab1e

Please sign in to comment.