[17:09:31] [Server thread/CRITICAL]: ErrorException: "Trying to access array offset on value of type null" (EXCEPTION) in "plugins/EnchantShopUI(6)(1)(1).phar/src/UnknownOre/EnchantUI/Main" at line 101 Here is the code public function buyForm(Player $player,int $id): void{ $array = $this->shop->getNested('shop'); $form = new CustomForm(function (Player $player, $data = null) use ($array, $id){ $var = array( "NAME" => $array[$id]['name'], "PRICE" => $array[$id]['price'] * $data[1], "LEVEL" => $data[1], "MONEY" => EconomyAPI::getInstance()->myMoney($player), "INCOMPATIBLE" => $incompatible = $this->isCompatible($player, $array[$id]['incompatible-enchantments']) ); if ($data === null){ $this->listForm($player); return; }
The prices are set, but whenever I do not buy anything in the form and I exit out of the form, I am being presented with the error.
https://github.com/UnknownOre/EnchantShopUI/blob/master/src/UnknownOre/EnchantUI/Main.php#L101 or the form $data is null swap this PHP: if ($data === null){ $this->listForm($player); return;}$var = array( "NAME" => $array[$id]['name'], "PRICE" => $array[$id]['price'] * $data[1], "LEVEL" => $data[1], "MONEY" => EconomyAPI::getInstance()->myMoney($player), "INCOMPATIBLE" => $incompatible = $this->isCompatible($player, $array[$id]['incompatible-enchantments']));