// See if the two teams have both played a third team k.
for (let k in results_i) {
if (!results_i.hasOwnProperty(k)) continue;
- if (results_j[k] !== undefined) {
+ if (results_j !== undefined && results_j[k] !== undefined) {
gd_i += results_i[k][0] - results_i[k][1];
gd_j += results_j[k][0] - results_j[k][1];
}
// See if the two teams have both played a third team k.
for (let k in results_i) {
if (!results_i.hasOwnProperty(k)) continue;
- if (results_j[k] !== undefined) {
+ if (results_j !== undefined && results_j[k] !== undefined) {
goals_i += results_i[k][0];
goals_j += results_j[k][0];
}