about summary refs log tree commit diff stats
path: root/src/local/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-12-14 19:21:27 +0100
committerbptato <nincsnevem662@gmail.com>2023-12-14 19:23:33 +0100
commit2f902aeaee8ffa6ceb54876af8f73f56f7840004 (patch)
tree9ef1efacf5204a61c54d412230a89a2b5df013b6 /src/local/client.nim
parentc7770d1a56cd65b15004df812de595d8a726c205 (diff)
downloadchawan-2f902aeaee8ffa6ceb54876af8f73f56f7840004.tar.gz
client: nil check connectSocketStream result
It may fail if the buffer process could not successfully create a server
socket.
Diffstat (limited to 'src/local/client.nim')
-rw-r--r--src/local/client.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/local/client.nim b/src/local/client.nim
index 469aff42..56fa5c42 100644
--- a/src/local/client.nim
+++ b/src/local/client.nim
@@ -326,13 +326,18 @@ proc acceptBuffers(client: Client) =
     else:
       client.pager.procmap.del(pid)
     stream.close()
+  var accepted: seq[Pid]
   for pid, container in client.pager.procmap:
     let stream = connectSocketStream(pid, buffered = false, blocking = true)
+    if stream == nil:
+      client.pager.alert("Error: failed to set up buffer")
+      continue
     container.setStream(stream)
     let fd = stream.source.getFd()
     client.fdmap[int(fd)] = container
     client.selector.registerHandle(fd, {Read}, 0)
     client.pager.handleEvents(container)
+    accepted.add(pid)
   client.pager.procmap.clear()
 
 proc c_setvbuf(f: File, buf: pointer, mode: cint, size: csize_t): cint {.