From f25cc39b24384ef25178e0be0ce1f0c757839da0 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 23 Jul 2013 10:49:47 +0300 Subject: [PATCH] Prevent paste from empty clipboard throwing an error Signed-off-by: Pasi Kallinen Signed-off-by: Ben Shum --- Open-ILS/xul/staff_client/chrome/content/util/clipboard.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/util/clipboard.js b/Open-ILS/xul/staff_client/chrome/content/util/clipboard.js index 75d225ab65..d180611a86 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/clipboard.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/clipboard.js @@ -57,7 +57,9 @@ util.clipboard.paste = function() { trans.addDataFlavor("text/unicode"); cb.getData(trans, cb.kGlobalClipboard); var str = {}; var strLength = {}; - trans.getTransferData("text/unicode",str,strLength); + try { + trans.getTransferData("text/unicode",str,strLength); + } catch(e) { /* clipboard is empty */ return; } if (str) str = str.value.QueryInterface(Components.interfaces.nsISupportsString); var clip; if (str) clip = str.data.substring(0, strLength.value / 2); n.value = v.substring(0, start) + clip + v.substring(end, v.length); -- 2.43.2