diff --git a/src/pocketmine/utils/Internet.php b/src/pocketmine/utils/Internet.php index 9b85f0eff..1f93e2f43 100644 --- a/src/pocketmine/utils/Internet.php +++ b/src/pocketmine/utils/Internet.php @@ -116,7 +116,10 @@ class Internet{ * @throws InternetException */ public static function getInternalIP() : string{ - $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); + $sock = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); + if($sock === false){ + throw new InternetException("Failed to get internal IP: " . trim(socket_strerror(socket_last_error()))); + } try{ if(!@socket_connect($sock, "8.8.8.8", 65534)){ throw new InternetException("Failed to get internal IP: " . trim(socket_strerror(socket_last_error($sock))));