fix List::length to work with stored CS10 projects

pull/3/merge
jmoenig 2014-07-17 09:51:25 +02:00
rodzic ff854784c0
commit 3dbe001d6f
2 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -2196,3 +2196,8 @@ ______
* Threads: fixed #506, thanks @haritop, for both the report and for providing the fix!!
* GUI: fixed #412 (incomplete sprite-removal)
* GUI: fixed #507 (limit persistent block zoom to 12x), thanks Michael!
* Morphic, GUI, Objects: fixed #508 (dont popup empty menus), thanks Michael!
140714
------
* Lists: make internal list ops iterative (instead of recursive), thanks, Brian!

Wyświetl plik

@ -195,11 +195,11 @@ List.prototype.length = function () {
if (this.isLinked) {
var pair = this,
result = 0;
while (pair.isLinked) {
while (pair && pair.isLinked) {
result += 1;
pair = pair.rest;
}
return result + pair.contents.length;
return result + (pair ? pair.contents.length : 0);
}
return this.contents.length;
};