1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Fix NULL pointer exception in some circumstances from Calendar's homepage

Summary:
After importing specific weird events, for example from Google Calendar (bleah), it can happen that the Calendar's homepage becomes broken.

This was the Exception error shown to video:

    "Call to a member function getEventsBetween() on null"

It was happening since this method can return NULL:

    PhabricatorCalendarEventQuery#newRecurrenceSet()

This changeset verifies this condition from the Calendar's homepage.

Closes T15136

Test Plan: I tried in my server. I've executed the syntax lint. On my local machine I was not able to run "arc diff" since it tries to connect to root@localhost for some reasons.

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: 0, Cigaryno, 20after4, speck, tobiaswiese, Matthew

Tags: #calendar

Maniphest Tasks: T15136

Differential Revision: https://we.phorge.it/D25060
This commit is contained in:
Valerio Bozzolan 2022-12-08 15:32:03 -07:00 committed by Matthew Bowker
parent a8a38835e1
commit dc558b5538

View file

@ -222,12 +222,16 @@ final class PhabricatorCalendarEventQuery
$limit = $this->getRecurrenceLimit($event, $raw_limit);
// note that this can be NULL for some imported events
$set = $event->newRecurrenceSet();
$recurrences = $set->getEventsBetween(
$start_date,
$end_date,
$limit + 1);
$recurrences = array();
if ($set) {
$recurrences = $set->getEventsBetween(
$start_date,
$end_date,
$limit + 1);
}
// We're generating events from the beginning and then filtering them
// here (instead of only generating events starting at the start date)