Skip to content

Commit b6fb940

Browse files
authored
fix: add null checks for frm.timeline in activity.js
1 parent ece33c9 commit b6fb940

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

frappe_gmail_thread/public/js/activity.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ function page_changed(event) {
88
if (route[0] == "Form") {
99
frappe.ui.form.on(route[1], {
1010
refresh: function (frm) {
11-
if (frm.timeline.doc_info.additional_timeline_content) {
11+
if (
12+
frm.timeline &&
13+
frm.timeline.doc_info &&
14+
frm.timeline.doc_info.additional_timeline_content
15+
) {
1216
let gthread_users = new Set();
1317
for (let activity of frm.timeline.doc_info.additional_timeline_content) {
1418
if (activity.doctype === "Gmail Thread") {
@@ -27,12 +31,15 @@ function page_changed(event) {
2731
const user_info = r.message;
2832
if ($.isEmptyObject(user_info)) return;
2933
frappe.update_user_info(user_info);
30-
frm.timeline.refresh();
34+
if(frm.timeline){
35+
frm.timeline.refresh();
36+
}
3137
});
3238
}
3339
frappe.realtime.on("gthread_new_email", function (data) {
34-
console.log("Received new email");
35-
frm.timeline.refresh();
40+
if(frm.timeline){
41+
frm.timeline.refresh();
42+
}
3643
});
3744
},
3845
});

0 commit comments

Comments
 (0)