Current Behavior
React frontend error trying to cast nulltoString
Expected behavior/code
Code should handle null values
Console OutputUncaught TypeError: Cannot read properties of null (reading 'toString')
Possible Solution
Compiled code source, line that's erroring out: let r = E_(e.tower_status_radiant.toString(2), 16).slice(5);
Metadata json loaded via network call has "tower_status_radiant": null,
Current Behavior React frontend error trying to cast
null
toString
Expected behavior/code Code should handle null values
Console Output
Uncaught TypeError: Cannot read properties of null (reading 'toString')
Possible Solution
Compiled code source, line that's erroring out:
let r = E_(e.tower_status_radiant.toString(2), 16).slice(5);
Metadata json loaded via network call has"tower_status_radiant": null,
Actual code: https://github.com/odota/web/blob/master/src/components/Match/BuildingMap/BuildingMap.jsx#L283
Above, we see a patch handler where it handles when
tower_status_radiant
is undefined, but not when it's null https://github.com/odota/web/blob/master/src/components/Match/BuildingMap/BuildingMap.jsx#L276-L278Possible solution: return empty section when information is unavailable?
Although this also hints at the API possibly returning bad data (tower status should never be null?)
Match ID: https://www.opendota.com/matches/7468445438