diff --git a/include/ws_functions/pwg.images.php b/include/ws_functions/pwg.images.php index 48bec1e1a..cbade03f2 100644 --- a/include/ws_functions/pwg.images.php +++ b/include/ws_functions/pwg.images.php @@ -2593,8 +2593,14 @@ function ws_images_setMd5sum($params, $service) include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); - $md5sum_ids_to_add = array_slice(get_photos_no_md5sum(), 0, $params['block_size']); - $added_count = add_md5sum($md5sum_ids_to_add); + $nb_no_md5sum = count(get_photos_no_md5sum()); + $added_count = 0; + + if ($nb_no_md5sum > 0) + { + $md5sum_ids_to_add = array_slice(get_photos_no_md5sum(), 0, $params['block_size']); + $added_count = add_md5sum($md5sum_ids_to_add); + } return array( 'nb_added' => $added_count,