Skip to content

Commit

Permalink
eventView.js: (minor) Fix possible undefined argument for
Browse files Browse the repository at this point in the history
set_events().

The current selected date may not have any events, so set_events()
would receive 'undefined' for the first argument.

Observed in logs as:
... JS ERROR: TypeError: event_data_list is undefined
... set_events@eventView.js:757:13
... _perform_gc@eventView.js:410:30

... JS LOG: [LookingGlass/warning] Invalid or null source id used when attempting to run Mainloop.source_remove()
... global.dump_gjs_stack@overrides.js:24:42
... Mainloop.source_remove@overrides.js:167:20
... _stop_gc_timer@eventView.js:384:22
... _start_gc_timer@eventView.js:390:14
... _handle_added_or_updated_events@eventView.js:453:14
  • Loading branch information
mtwebster committed Jan 8, 2025
1 parent 2aa91fc commit c4c0489
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class EventsManager {
}

if (any_removed) {
this._event_list.set_events(this.events_by_date[this.current_selected_date.to_unix()]);
this._event_list.set_events(this.events_by_date[this.current_selected_date.to_unix()] || null);
this.emit("events-updated");
}

Expand Down Expand Up @@ -445,7 +445,7 @@ class EventsManager {
}

if (changed) {
this._event_list.set_events(this.events_by_date[this.current_selected_date.to_unix()]);
this._event_list.set_events(this.events_by_date[this.current_selected_date.to_unix()] || null);
}

this._start_gc_timer();
Expand Down

0 comments on commit c4c0489

Please sign in to comment.