Skip to content

Commit

Permalink
Don't display 'undefined' when the countryName is not available (#96)
Browse files Browse the repository at this point in the history
Signed-off-by: Mika Theodore <michael.theodore@rte-france.com>
  • Loading branch information
mikatheo authored Apr 16, 2020
1 parent a44cdb8 commit d14de65
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/network/network-explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ const NetworkExplorer = ({network, onVoltageLevelDisplayClick, onVoltageLevelFoc

const voltagelevelInfo = index => {
if (network.getSubstation(filteredVoltageLevels[index].substationId)) {
return filteredVoltageLevels[index].nominalVoltage + " kV — " + network.getSubstation(filteredVoltageLevels[index].substationId).countryName;
let info = filteredVoltageLevels[index].nominalVoltage + " kV";
if (network.getSubstation(filteredVoltageLevels[index].substationId).countryName !== undefined) {
info += " — " + network.getSubstation(filteredVoltageLevels[index].substationId).countryName;
}
return info;
}
};

Expand Down

0 comments on commit d14de65

Please sign in to comment.