diff options
| author | jmoenig <jens@moenig.org> | 2014-11-20 14:17:06 +0100 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2014-11-20 14:17:06 +0100 |
| commit | 89c2835130e5f77e92c35c52b26d58370be07a7c (patch) | |
| tree | 6bd46681245ee88a70a97e32e07ad7bcfa99ef87 | |
| parent | ea05f7859fe5a042f0c0dd49b189c594b9a798d3 (diff) | |
| download | snap-byow-89c2835130e5f77e92c35c52b26d58370be07a7c.tar.gz snap-byow-89c2835130e5f77e92c35c52b26d58370be07a7c.zip | |
Fixed #642, avoid “freezing” when calling CONS on non-list/null
thanks, @brianharvey !
| -rwxr-xr-x | history.txt | 4 | ||||
| -rw-r--r-- | lists.js | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/history.txt b/history.txt index 88d7ca4..53bd4a6 100755 --- a/history.txt +++ b/history.txt @@ -2321,3 +2321,7 @@ ______ 141117 ------ * Threads, Blocks: Treat REPORT blocks inside custom command definitions as STOP THIS BLOCK / IGNORE INPUTS + +141120 +------ +* Lists: Fixed #642, avoid “freezing” when calling CONS on non-list/null @@ -61,7 +61,7 @@ PushButtonMorph, SyntaxElementMorph, Color, Point, WatcherMorph, StringMorph, SpriteMorph, ScrollFrameMorph, CellMorph, ArrowMorph, MenuMorph, snapEquals, Morph, isNil, localize, MorphicPreferences*/ -modules.lists = '2014-July-28'; +modules.lists = '2014-November-20'; var List; var ListWatcherMorph; @@ -125,6 +125,9 @@ List.prototype.changed = function () { List.prototype.cons = function (car, cdr) { var answer = new List(); + if (!(cdr instanceof List || isNil(cdr))) { + throw new Error("cdr isn't a list: " + cdr); + } answer.first = isNil(car) ? null : car; answer.rest = cdr || null; answer.isLinked = true; |
