Skip to content

Commit ca257c8

Browse files
committed
Add proper check before calling stop()
1 parent 798a43b commit ca257c8

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

LibEvLoop.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,24 @@ public function addWriteStream($stream, $listener)
3535

3636
public function removeReadStream($stream)
3737
{
38-
$this->readEvents[(int)$stream]->stop();
39-
unset($this->readEvents[(int)$stream]);
38+
if (isset($this->readEvents[(int)$stream])) {
39+
$this->readEvents[(int)$stream]->stop();
40+
unset($this->readEvents[(int)$stream]);
41+
}
4042
}
4143

4244
public function removeWriteStream($stream)
4345
{
44-
$this->writeEvents[(int)$stream]->stop();
45-
unset($this->writeEvents[(int)$stream]);
46+
if (isset($this->writeEvents[(int)$stream])) {
47+
$this->writeEvents[(int)$stream]->stop();
48+
unset($this->writeEvents[(int)$stream]);
49+
}
4650
}
4751

4852
public function removeStream($stream)
4953
{
50-
if (isset($this->readEvents[(int)$stream])) {
51-
$this->removeReadStream($stream);
52-
}
53-
54-
if (isset($this->writeEvents[(int)$stream])) {
55-
$this->removeWriteStream($stream);
56-
}
54+
$this->removeReadStream($stream);
55+
$this->removeWriteStream($stream);
5756
}
5857

5958
private function addStream($stream, $listener, $flags)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy