Skip to content

Commit 7868536

Browse files
authored
closes loiane#13
1 parent d0ebbf9 commit 7868536

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

chapter07/07-HashCollisionLinearProbing.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ function HashLinearProbing(){
4646
return table[position].value;
4747
} else {
4848
var index = ++position;
49-
while (table[index] === undefined || table[index].key !== key){
49+
while (table[index] !== undefined && (table[index] && table[index].key !== key)){
5050
index++;
5151
}
52-
if (table[index].key === key) {
52+
if (table[index] && table[index].key === key) {
5353
return table[index].value;
5454
}
5555
}
@@ -82,4 +82,4 @@ function HashLinearProbing(){
8282
}
8383
}
8484
};
85-
}
85+
}

0 commit comments

Comments
 (0)