mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Fixed pthreads infinite loop when string length was <= 0
This commit is contained in:
parent
d4c4f8817d
commit
cf5e2f63db
@ -46,10 +46,17 @@ class AsyncMultipleQueue extends Thread{
|
||||
|
||||
private function get($len){
|
||||
$str = "";
|
||||
while(!isset($str{$len - 1})){
|
||||
$str .= $this->input{0};
|
||||
$this->input = (string) substr($this->input, 1);
|
||||
if($len <= 0){
|
||||
return $len;
|
||||
}
|
||||
$offset = 0;
|
||||
while(!isset($str{$len - 1})){
|
||||
if(isset($this->input{$offset})){
|
||||
$str .= $this->input{$offset};
|
||||
++$offset;
|
||||
}
|
||||
}
|
||||
$this->input = (string) substr($this->input, $offset);
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user