From b8599d0414046e360a1b87142182d55aa7977b34 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 21 May 2009 14:27:36 +0000 Subject: [PATCH] Add a safeguard into Zotero.Attachments.getStorageDirectory(itemID) to make sure it returns an actual item directory --- chrome/content/zotero/xpcom/attachments.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 098f09683..9cafb661b 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -967,6 +967,9 @@ Zotero.Attachments = new function(){ function getStorageDirectory(itemID) { var item = Zotero.Items.get(itemID); + if (!item) { + throw ("Item " + itemID + " not found in Zotero.Attachments.getStorageDirectory()"); + } var dir = Zotero.getStorageDirectory(); dir.append(item.key); return dir;