summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2014-07-17 09:51:25 +0200
committerjmoenig <jens@moenig.org>2014-07-17 09:51:25 +0200
commit3dbe001d6f47c0cf6dd9f34ca746201894a32dd7 (patch)
tree21ad255096ea959feff1785d7f6d7350c41e9fa9
parentff854784c0bb86c2a28818284876b045cabc10a1 (diff)
downloadsnap-byow-3dbe001d6f47c0cf6dd9f34ca746201894a32dd7.tar.gz
snap-byow-3dbe001d6f47c0cf6dd9f34ca746201894a32dd7.zip
fix List::length to work with stored CS10 projects
-rwxr-xr-xhistory.txt5
-rw-r--r--lists.js4
2 files changed, 7 insertions, 2 deletions
diff --git a/history.txt b/history.txt
index 541905e..c21df56 100755
--- a/history.txt
+++ b/history.txt
@@ -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 (don’t popup empty menus), thanks Michael!
+
+140714
+------
+* Lists: make internal list ops iterative (instead of recursive), thanks, Brian!
diff --git a/lists.js b/lists.js
index 1674d1c..c5a7cc6 100644
--- a/lists.js
+++ b/lists.js
@@ -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;
};