sometimes when looking for next/prev the image doesn't exist

This commit is contained in:
Shish 2012-01-14 14:38:45 +00:00
parent 0a4e8e05f0
commit 9d36a6a1bb

View File

@ -87,6 +87,10 @@ class ViewImage extends SimpleExtension {
} }
$image = Image::by_id($image_id); $image = Image::by_id($image_id);
if(is_null($image)) {
$this->theme->display_error($page, "Image not found", "Image $image_id could not be found");
return;
}
if($event->page_matches("post/next")) { if($event->page_matches("post/next")) {
$image = $image->get_next($search_terms); $image = $image->get_next($search_terms);
} }