Check for missing bytarget info nodes before dereferer
authorDennis Schafroth <dennis@indexdata.com>
Thu, 2 Feb 2012 17:35:16 +0000 (18:35 +0100)
committerDennis Schafroth <dennis@indexdata.com>
Thu, 2 Feb 2012 17:35:16 +0000 (18:35 +0100)
js/pz2.js

index 6b76796..096a89d 100644 (file)
--- a/js/pz2.js
+++ b/js/pz2.js
@@ -652,10 +652,17 @@ pz2.prototype =
                                 == Node.ELEMENT_NODE ) {
                                 var nodeName = 
                                     targetNodes[i].childNodes[j].nodeName;
-                                var nodeText = 
-                                    targetNodes[i].childNodes[j]
-                                        .firstChild.nodeValue;
-                                bytarget[i][nodeName] = nodeText;
+                               if (tagetNodes[i].childNodes[j].firstChild != null) 
+                               {
+                                    var nodeText = targetNodes[i].childNodes[j]
+                                       .firstChild.nodeValue;
+                                    bytarget[i][nodeName] = nodeText;
+                               }
+                               else { 
+                                   bytarget[i][nodeName] = "";  
+                               }
+
+
                             }
                         }
                         if (bytarget[i]["state"]=="Client_Disconnected") {