From a09c277ae720a99bb543d02df65ecf82ce17f7ab Mon Sep 17 00:00:00 2001
From: Nathan Gray <nathangray.bsc@gmail.com>
Date: Wed, 12 Oct 2011 16:34:52 +0000
Subject: [PATCH] Log a warning if et2_insertLinkText is called without a node

---
 etemplate/js/et2_core_common.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/etemplate/js/et2_core_common.js b/etemplate/js/et2_core_common.js
index fd4580d900..90e317312e 100644
--- a/etemplate/js/et2_core_common.js
+++ b/etemplate/js/et2_core_common.js
@@ -645,6 +645,12 @@ function et2_activateLinks(_content)
  */
 function et2_insertLinkText(_text, _node, _target)
 {
+	if(!_node) 
+	{
+		et2_debug("warn", "et2_insertLinkText called without node", _text, _node, _target);
+		return;
+	}
+
 	// Clear the node
 	for (var i = _node.childNodes.length - 1; i >= 0; i--)
 	{
@@ -661,9 +667,14 @@ function et2_insertLinkText(_text, _node, _target)
 		}
 		else
 		{
+			if(!s.href)
+			{
+				et2_debug("warn", "et2_activateLinks gave bad data", s, _node, _target);
+				s.href = "";
+			}
 			var a = $j(document.createElement("a"))
 				.attr("href", s.href)
-				.text(s.text);
+				.text(s.text ? s.text : "-"+egw.lang("missing")+"-");
 
 			if (typeof _target != "undefined" && _target && _target != "_self")
 			{