diff --git a/src/api/wishlists.php b/src/api/wishlists.php index 1f7c3972..22bf3be7 100644 --- a/src/api/wishlists.php +++ b/src/api/wishlists.php @@ -148,12 +148,9 @@ switch ($_SERVER['REQUEST_METHOD']) { http_response_code(404); } } elseif ($getWishlistFromHash) { - /** - * Get wishlist by hash - */ $wishlist = Wishlist::getFromHash($_GET['wishlist_hash']); - if ($wishlist->exists) { + if ($wishlist instanceof Wishlist) { $response['results'] = $wishlist; } else { http_response_code(404); diff --git a/src/classes/wishthis/Wishlist.php b/src/classes/wishthis/Wishlist.php index 469749c7..eb07bbc1 100644 --- a/src/classes/wishthis/Wishlist.php +++ b/src/classes/wishthis/Wishlist.php @@ -33,7 +33,7 @@ class Wishlist return $wishlist; } - public static function getFromHash(string $hash): self + public static function getFromHash(string $hash): self|false { global $database; diff --git a/src/pages/wishlist.php b/src/pages/wishlist.php index 078e351d..0be4ffdd 100644 --- a/src/pages/wishlist.php +++ b/src/pages/wishlist.php @@ -17,7 +17,7 @@ $page->scripts['wish'] = 'src/assets/js/parts/wish.js'; $page->scripts['wishlist-filter-priority'] = 'src/assets/js/parts/wishlist-filter-priority.js'; $page->scripts['wishlists'] = 'src/assets/js/parts/wishlists.js'; -if (!$wishlist->exists) { +if (false === $wishlist) { $page->errorDocument(404, $wishlist); }