git ssb

16+

Dominic / patchbay



Commit 32f894d5b634ccd79fb713e98e1ab5f5cf7d9819

Fix u.next looping on empty streams

Charles Lehner committed on 6/30/2016, 2:32:13 PM
Parent: 7943e743e227f271fee302ea63fc033e49f380bc

Files changed

util.jschanged
util.jsView
@@ -39,18 +39,21 @@
3939 return Next(function () {
4040 if(last) {
4141 if(count === 0) return
4242 var value = opts[range] = get(last, property)
43- if(value === stop) return null
43+ if(value == null) return
44+ last = null
4445 }
4546 return pull(
4647 createStream(opts),
4748 pull.through(function (msg) {
4849 count ++
4950 if(!msg.sync) last = msg
5051 }, function (err) {
5152 //retry on errors...
52- if(err) count = -1
53+ if(err) return count = -1
54+ //end stream if there were no results
55+ if(last == null) last = {}
5356 })
5457 )
5558 })
5659 }

Built with git-ssb-web