Check if the regex matching returns null before using it further

Fix #12473 : Code can throw unhandled exception

Signed-off-by: Deven Bansod <devenbansod.bits@gmail.com>
This commit is contained in:
Deven Bansod 2016-09-14 23:06:25 +05:30
parent d6b80ad910
commit 10e4f0a3dd

View File

@ -613,8 +613,12 @@ function confirmLink(theLink, theSqlQuery)
if (is_confirmed) {
if ($(theLink).hasClass('formLinkSubmit')) {
var name = 'is_js_confirmed';
if ($(theLink).attr('href').indexOf('usesubform') != -1) {
name = 'subform[' + $(theLink).attr('href').substr('#').match(/usesubform\[(\d+)\]/i)[1] + '][is_js_confirmed]';
var matches = $(theLink).attr('href').substr('#').match(/usesubform\[(\d+)\]/i);
if (matches != null) {
name = 'subform[' + matches[1] + '][is_js_confirmed]';
}
}
$(theLink).parents('form').append('<input type="hidden" name="' + name + '" value="1" />');