diff --git a/update.php b/update.php
index 3f18b26892780a45369a38770194dd8cf722166d..457dcc3f73262e72e5cc69a5eae5d4fcb78c496f 100644
--- a/update.php
+++ b/update.php
@@ -420,7 +420,7 @@ function update_progress_page() {
  *   the overall percentage finished. The second element is a status message.
  */
 function update_do_updates() {
-  while (($update = reset($_SESSION['update_remaining']))) {
+  while (isset($_SESSION['update_remaining']) && ($update = reset($_SESSION['update_remaining']))) {
     $update_finished = update_data($update['module'], $update['version']);
     if ($update_finished == 1) {
       // Dequeue the completed update.