From 7dfd9004fc9e2a89782d2bc5a8d79bf998732c91 Mon Sep 17 00:00:00 2001 From: dbs Date: Fri, 5 Mar 2010 21:36:40 +0000 Subject: [PATCH] Forward-port r15723: Prevent throwing a raw exception due to the manipulation of a non-existent node when removing a patron standing penalty git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6@15724 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../xul/staff_client/server/patron/standing_penalties.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/standing_penalties.js b/Open-ILS/xul/staff_client/server/patron/standing_penalties.js index 3f4fa9df3a..db998b9451 100644 --- a/Open-ILS/xul/staff_client/server/patron/standing_penalties.js +++ b/Open-ILS/xul/staff_client/server/patron/standing_penalties.js @@ -136,8 +136,20 @@ function penalty_init() { var parentNode = node.parentNode; parentNode.removeChild( node ); delete(rows[ id ]); - var csp_id = typeof penalty.standing_penalty() == 'object' ? penalty.standing_penalty().id() : penalty.standing_penalty(); - document.getElementById('csp_'+csp_id).setAttribute('disabled','false'); + + var csp_id; + if (typeof penalty.standing_penalty() == 'object') { + csp_id = penalty.standing_penalty().id(); + } else { + csp_id = penalty.standing_penalty(); + } + + // Protect against manipulating a node that doesn't exist - which will + // be the case for system penalties with an ID of < 100 -- see csp_list above + var csp_node = document.getElementById('csp_'+csp_id); + if (csp_node) { + csp_node.setAttribute('disabled','false'); + } } } catch(E) { alert(E); -- 2.11.0