From 8ac1abc74ebace4879f1b190bcb02a9c11c7bc51 Mon Sep 17 00:00:00 2001 From: Liam Whalen Date: Sat, 14 Feb 2015 00:25:05 -0800 Subject: [PATCH] LP#1282286 Tab is NULL error When editing a MARC record in Vandelay or MFHD holdings in a popup XUL WIndow, a tab is NULL error is presented to the user. This happens because an undefined variable is being used when it should not be. This code adds a check for that variable to ensure it exists before using it. The variable used only matters in cases where tabs are present, which is not the case with pop up MARC edit windows, so ignoring the variable in these cases is fine. Signed-off-by: Liam Whalen Signed-off-by: Jason Stephenson --- Open-ILS/xul/staff_client/server/cat/marcedit.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index 0a9bf03441..05ce1c40fb 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -604,7 +604,9 @@ function set_lock_on_keypress(ev) { || ev.keyCode == ev.DOM_VK_F24 )) { var params = {}; - params.allow_multiple_locks = tab.marc_edit_allow_multiple_locks; + if (tab) { + params.allow_multiple_locks = tab.marc_edit_allow_multiple_locks; + } oils_lock_page(params); } } catch(E) { @@ -1370,8 +1372,10 @@ function loadRecord() { if (tabs) { var idx = tabs.selectedIndex; var tab = tabs.childNodes[idx]; - tab.marc_edit_changed = false; - tab.marc_edit_allow_multiple_locks = true; + if (tab) { + tab.marc_edit_changed = false; + tab.marc_edit_allow_multiple_locks = true; + } } var grid_rows = document.getElementById('recGrid').lastChild; -- 2.11.0