protecting against edge case where we run off the end of the org table before finding...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 28 Jan 2008 15:09:11 +0000 (15:09 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 28 Jan 2008 15:09:11 +0000 (15:09 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2_1@8512 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/skin/default/js/rdetail.js

index a2c2d06..3ce50cf 100644 (file)
@@ -576,10 +576,13 @@ function _rdetailBuildInfoRows(r) {
                 sib = rowNode.nextSibling;
                 o ='cp_info_'+thisOrg.id()+'_';
                 /* push the new row on as the last row for this org unit */
-                while( sib.id.match(o) ) {
+                while( sib && sib.id.match(o) ) {
                     sib = sib.nextSibling;
                 }
-                               rowNode = copyRowParent.insertBefore(copyRow.cloneNode(true), sib);
+                if(sib)
+                                   rowNode = copyRowParent.insertBefore(copyRow.cloneNode(true), sib);
+                else
+                    rowNode = copyRowParent.appendChild(copyRow.cloneNode(true));
             } else {
                                rowNode = copyRowParent.appendChild(copyRow.cloneNode(true));
             }