File tree Expand file tree Collapse file tree 1 file changed +22
-8
lines changed
Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -24,19 +24,29 @@ public function __construct($resource) {
2424
2525 for ($ idx = 0 ; $ idx < count ($ resource ['fields ' ]); $ idx ++) {
2626 $ field = $ resource ['fields ' ][$ idx ];
27+ $ value = $ field ['actual_field_value ' ];
2728
2829 switch ($ field ['field_id ' ]) {
2930 case 'native_mc_version ' :
30- $ this ->native_minecraft_version = self ::cleanupVersion ($ field ['actual_field_value ' ]);
31+ if (is_null ($ value ) || empty ($ value )) {
32+ $ this ->native_minecraft_version = NULL ;
33+ } else {
34+ $ this ->native_minecraft_version = self ::cleanupVersion ($ value );
35+ }
3136 break ;
3237 case 'mc_versions ' :
33- $ versions = array_map (
34- function ($ version ) {
35- return self ::cleanupVersion ($ version );
36- },
37- unserialize ($ field ['actual_field_value ' ])
38- );
39- $ this ->supported_minecraft_versions = array_values ($ versions );
38+ if (is_null ($ value ) || empty ($ value )) {
39+ $ this ->supported_minecraft_versions = array ();
40+ } else {
41+ $ versions = array_map (
42+ function ($ version ) {
43+ return self ::cleanupVersion ($ version );
44+ },
45+ unserialize ($ value )
46+ );
47+
48+ $ this ->supported_minecraft_versions = array_values ($ versions );
49+ }
4050 break ;
4151 }
4252 }
@@ -67,6 +77,10 @@ function($version) {
6777 }
6878
6979 private static function cleanupVersion ($ value ) {
80+ if (is_null ($ value ) || (is_string ($ value ) && empty ($ value ))) {
81+ return NULL ;
82+ }
83+
7084 if (strtolower ($ value ) != 'legacy ' ) {
7185 $ value = str_replace ('_ ' , '. ' , $ value );
7286 }
You can’t perform that action at this time.
0 commit comments