From 95cf12bd3896be13f6f848f87e30ec83841d1802 Mon Sep 17 00:00:00 2001
From: Shish <shish@shishnet.org>
Date: Mon, 26 Jul 2010 22:59:18 +0100
Subject: [PATCH] only favourite valid images

---
 contrib/favorites/main.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/favorites/main.php b/contrib/favorites/main.php
index 9d1de207..894adea2 100644
--- a/contrib/favorites/main.php
+++ b/contrib/favorites/main.php
@@ -59,7 +59,7 @@ class Favorites extends SimpleExtension {
 		global $page, $user;
 		if($event->page_matches("change_favorite") && !$user->is_anonymous()) {
 			$image_id = int_escape($_POST['image_id']);
-			if (($_POST['favorite_action'] == "set") || ($_POST['favorite_action'] == "unset")) {
+			if((($_POST['favorite_action'] == "set") || ($_POST['favorite_action'] == "unset")) && ($image_id > 0)) {
 				send_event(new FavoriteSetEvent($image_id, $user, ($_POST['favorite_action'] == "set")));
 			}
 			$page->set_mode("redirect");