fix: click handler should not attempt indexed access of empty array (#35013)

fix: click handler should not attempt indexed access of empty array (#35013)

fix: click handler should not attempt indexed access
of empty array

(cherry picked from commit 3d90b970d1)

Co-authored-by: tundebabzy <tundebabzy@gmail.com>
This commit is contained in:
mergify[bot]
2023-04-25 21:11:08 +05:30
committed by GitHub
parent 47df41fdbd
commit 06f204a8d6

View File

@@ -68,7 +68,7 @@ erpnext.timesheet.control_timer = function(frm, dialog, row, timestamp=0) {
// New activity if no activities found // New activity if no activities found
var args = dialog.get_values(); var args = dialog.get_values();
if(!args) return; if(!args) return;
if (frm.doc.time_logs.length <= 1 && !frm.doc.time_logs[0].activity_type && !frm.doc.time_logs[0].from_time) { if (frm.doc.time_logs.length == 1 && !frm.doc.time_logs[0].activity_type && !frm.doc.time_logs[0].from_time) {
frm.doc.time_logs = []; frm.doc.time_logs = [];
} }
row = frappe.model.add_child(frm.doc, "Timesheet Detail", "time_logs"); row = frappe.model.add_child(frm.doc, "Timesheet Detail", "time_logs");