From a153ca082971e1eb454aa66199ee0380a9794a6e Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 2 Oct 2010 17:04:37 -0700 Subject: [PATCH] Detect the case where there are no more broken images and skip to the end. Fixes #1414. --- modules/gallery/helpers/gallery_task.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php index 3b173928e2..d56edabb9c 100644 --- a/modules/gallery/helpers/gallery_task.php +++ b/modules/gallery/helpers/gallery_task.php @@ -84,6 +84,13 @@ static function rebuild_dirty_images($task) { $ignored = $task->get("ignored", array()); $i = 0; + + // If there's no work left to do, skip to the end. This can happen if we resume a task long + // after the work got done in some other task. + if (!$result->count()) { + $completed = $total_count; + } + foreach ($result as $row) { if (array_key_exists($row->id, $ignored)) { continue;