From 9a01fb1de9ece0c4d37cb331e51e3b0b7dcf75a8 Mon Sep 17 00:00:00 2001
From: Klap-in <klapinklapin@gmail.com>
Date: Mon, 28 Jan 2013 01:39:57 +0100
Subject: [PATCH] Add some breaks to while loops.

---
 inc/changelog.php | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/inc/changelog.php b/inc/changelog.php
index d2be5b2db..c5c1c8246 100644
--- a/inc/changelog.php
+++ b/inc/changelog.php
@@ -697,6 +697,7 @@ function getRelativeRevision($id, $rev, $direction, $chunk_size = 8192, $media =
                     if($lookpointer) {
                         $tail = $head + floor(($tail - $head) / 2);
                     }
+                    if($tail == $head) break;
                 }
             } else {
                 $tail = $head;
@@ -706,6 +707,7 @@ function getRelativeRevision($id, $rev, $direction, $chunk_size = 8192, $media =
 
             //load next chunck
             $lines = readChunk($fp, $head, $tail);
+            if(empty($lines)) break;
         }
     }
     if($uses_chuncks) {
-- 
GitLab