Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Stop [Z] from hanging

  • Loading branch information...
commit f585b2644ad58004534f56207b0c6e11fa0748fe 1 parent e2f3bfa
Stefan O'Rear authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/Builtins.cs
4 lib/Builtins.cs
View
@@ -1994,10 +1994,12 @@ class ItemSource {
protected ItemSource() {}
[Immutable]
public static ItemSource Empty = new ItemSource();
+ // main access point - return true to block (only if block is true)
public virtual bool TryGet(out Variable[] r, bool block) {
r = null;
return true;
}
+ // utility to get data from a list
protected static int TryOne(VarDeque items, bool block) {
if (block) {
return Kernel.IterHasFlat(items, true) ? +1 : -1;
@@ -2062,6 +2064,8 @@ class ZipSource : ItemSource {
case -1: return true;
case 0: return false;
}
+ if (sources.Length == 0)
+ return true; // empty zip should return immediately
r = new Variable[sources.Length];
for (int i = 0; i < sources.Length; i++)
r[i] = sources[i].Shift();
Please sign in to comment.
Something went wrong with that request. Please try again.