Use Utils::assumeNotFalse() in tools/

This commit is contained in:
Dylan K. Taylor
2021-12-08 20:01:19 +00:00
parent 77a74d84e2
commit 2254f31bec
3 changed files with 11 additions and 30 deletions

View File

@ -23,7 +23,7 @@ declare(strict_types=1);
namespace pocketmine\tools\ping_server;
use pocketmine\utils\AssumptionFailedError;
use pocketmine\utils\Utils;
use raklib\protocol\MessageIdentifiers;
use raklib\protocol\PacketSerializer;
use raklib\protocol\UnconnectedPing;
@ -137,8 +137,7 @@ if(count($argv) > 2){
$port = $portRaw === "" ? 19132 : (int) $portRaw;
}
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
if($sock === false) throw new AssumptionFailedError();
$sock = Utils::assumeNotFalse(socket_create(AF_INET, SOCK_DGRAM, SOL_UDP));
socket_bind($sock, "0.0.0.0");
socket_getsockname($sock, $bindAddr, $bindPort);