mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-07 02:21:46 +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){
|
private function get($len){
|
||||||
$str = "";
|
$str = "";
|
||||||
while(!isset($str{$len - 1})){
|
if($len <= 0){
|
||||||
$str .= $this->input{0};
|
return $len;
|
||||||
$this->input = (string) substr($this->input, 1);
|
|
||||||
}
|
}
|
||||||
|
$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;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user