summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-05-31 22:30:48 -0700
committerBharat Mediratta <bharat@menalto.com>2009-05-31 22:30:48 -0700
commit9a7e642cd6cc3d250d9d413c3ce0414e92e9d769 (patch)
tree797a251835868e55ed42a8ee600e85d27fd13114
parent33df7de391eebdab2cb09ca97207cb81f4274cd1 (diff)
Don't let relative_path() try to update the database if the Item_Model
is not loaded, else you get weird errors.
-rw-r--r--modules/gallery/models/item.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 4b8cac8e..9406f5d9 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -287,6 +287,10 @@ class Item_Model extends ORM_MPTT {
* @return string
*/
public function relative_path() {
+ if (!$this->loaded) {
+ return;
+ }
+
if (!isset($this->relative_path_cache)) {
$paths = array();
foreach (Database::instance()