Fix monster not found exception

This commit is contained in:
slawkens 2024-07-10 09:54:54 +02:00
parent 9a27403e7d
commit ef79b99b8a

View File

@ -39,9 +39,11 @@ if (empty($_REQUEST['name'])) {
// display monster
$monster_name = urldecode(stripslashes(ucwords(strtolower($_REQUEST['name']))));
$monster = Monster::where('hide', '!=', 1)->where('name', $monster_name)->first()->toArray();
$monster = Monster::where('hide', '!=', 1)->where('name', $monster_name)->first();
if ($monster && isset($monster->name)) {
$monster = $monster->toArray();
if (isset($monster['name'])) {
function sort_by_chance($a, $b)
{
if ($a['chance'] == $b['chance']) {