Skip to content

Commit

Permalink
prevent nil messages from messing up alts
Browse files Browse the repository at this point in the history
  • Loading branch information
richhickey committed Jan 16, 2025
1 parent 313569a commit 3ee4a34
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ pom.xml.versionsBackup
.classpath
ccw.repl.cmdhistory.prefs
nbactions.xml
.DS_Store
5 changes: 3 additions & 2 deletions src/main/clojure/clojure/core/async/flow/impl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,9 @@
(loop [nstatus nstatus, nstate nstate, msgs (seq msgs)]
(if (or (nil? msgs) (= nstatus :exit))
[nstatus nstate]
(let [[v c] (async/alts!!
[control [outc (first msgs)]]
(let [m (if-some [m (first msgs)] m (throw "messages must be non-nil"))
[v c] (async/alts!!
[control [outc m]]
:priority true)]
(if (= c control)
(let [nnstatus (handle-command nstatus v)
Expand Down

0 comments on commit 3ee4a34

Please sign in to comment.