From aebac8bcd0e946f1e7283d8e280e301d52b8d64b Mon Sep 17 00:00:00 2001 From: rstular Date: Mon, 1 Jun 2020 20:14:59 +0200 Subject: gsec bug fix - regex may return null --- assets/js/gsec.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'assets') diff --git a/assets/js/gsec.js b/assets/js/gsec.js index 19e190f..5632949 100644 --- a/assets/js/gsec.js +++ b/assets/js/gsec.js @@ -273,8 +273,10 @@ class gsec { } rowSpan.remove(); // magic - var subject = SUBJECT_REGEX.exec(subFields[1].innerHTML)[1].trim(); - var desc = DESC_REGEX.exec(subFields[1].innerHTML)[1]; + var subject = SUBJECT_REGEX.exec(subFields[1].innerHTML) + subject = subject == null ? "" : subject[1].trim(); + var desc = DESC_REGEX.exec(subFields[1].innerHTML); + desc = desc == null ? "" : desc[1]; gradings.push({ "date": dateObj, @@ -529,7 +531,7 @@ class gsec { "__EVENTARGUMENT": "Select$" + selectId }; - this.postback(GSE_URL+"Page_Gim/Uporabnik/Sporocila.aspx", dataToBeSent, null, true).then((response) => { + this.postback(GSE_URL + "Page_Gim/Uporabnik/Sporocila.aspx", dataToBeSent, null, true).then((response) => { let parser = new DOMParser(); let parsed = parser.parseFromString(response.data, "text/html"); let subject = parsed.getElementsByClassName("msgSubjectS")[0].innerHTML.trim(); -- cgit v1.2.3