Skip to content

Commit 781ec0d

Browse files
committed
Fix JSON null players
1 parent cd50b0e commit 781ec0d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fragland/minestat",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"type": "library",
55
"description": "A Minecraft server status checker",
66
"keywords": ["Minecraft","status"],

minestat.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class MineStat
2323
{
24-
const VERSION = "3.0.0"; // MineStat version
24+
const VERSION = "3.0.1"; // MineStat version
2525
const NUM_FIELDS = 6; // number of values expected from server
2626
const NUM_FIELDS_BETA = 3; // number of values expected from a 1.8b/1.3 server
2727
const MAX_VARINT_SIZE = 5; // maximum number of bytes a varint can be
@@ -610,8 +610,8 @@ public function json_request()
610610
$this->version = @$json_data['version']['name'];
611611
$this->motd = @$json_data['description'];
612612
$this->strip_motd();
613-
$this->current_players = (int)@$json_data['players']['online'];
614-
$this->max_players = (int)@$json_data['players']['max'];
613+
$this->current_players = (int)@$json_data['players']['online'] ?? -1;
614+
$this->max_players = (int)@$json_data['players']['max'] ?? -1;
615615
$this->favicon_b64 = @$json_data['favicon'];
616616
if(isset($this->favicon_b64))
617617
{

0 commit comments

Comments
 (0)