Make fetch_prev_rev() work if there is no history
authorRobert Sesek <rsesek@bluestatic.org>
Thu, 12 Jan 2006 18:17:20 +0000 (18:17 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Thu, 12 Jan 2006 18:17:20 +0000 (18:17 +0000)
includes/cachev.php

index 16d94605b17484d1cb5beec34f113b0ddb3b2f27..2053e28c3c040d061245e32c60091f1b343047bb 100644 (file)
@@ -139,6 +139,11 @@ class cacheV
                $data = $this->fetch_node($node);
                $data = $data['history'];
                
+               if (count($data['history']) < 1)
+               {
+                       return $this->fetch_revision(0);
+               }
+               
                unset($data[ max(array_keys($data)) ]);
                
                return $this->fetch_revision(max(array_keys($data)));