Bug 36868: Move array splice in OPAC js to after the -1 check

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Lucas Gass 2026-09-09 13:59:37 +00:00 committed by Pedro Amorim
parent 5579974cd1
commit b369ba5d17
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 1 additions and 1 deletions

View File

@ -234,13 +234,13 @@ function delSingleRecord(biblionumber) {
var valCookie = readCookie(nameCookie);
var arrayRecords = valCookie.split("/");
var pos = jQuery.inArray(biblionumber, arrayRecords);
arrayRecords.splice(pos, 1);
// if pos is -1, the cart is empty, bail
if (pos === -1) {
return;
}
arrayRecords.splice(pos, 1);
valCookie = arrayRecords.join("/");
writeCookie(nameCookie, valCookie);
updateBasket(arrayRecords.length - 1);