Skip to content

Commit

Permalink
fix: Null assignment on events loading
Browse files Browse the repository at this point in the history
  • Loading branch information
bdlukaa committed Jul 10, 2024
1 parent a9c4c60 commit 4240ddd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/providers/events_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ extension EventsScreenProvider on EventsProvider {
loadedEvents = LoadedEvents();
_notify();

startDate ??= this.startDate;
endDate ??= this.endDate;

// Load the events at the same time
await Future.wait(ServersProvider.instance.servers.map((server) async {
if (!server.online || server.devices.isEmpty) return;
Expand All @@ -158,8 +161,8 @@ extension EventsScreenProvider on EventsProvider {
await Future.wait(allowedDevices.map((device) async {
final iterable = (await API.instance.getEvents(
server,
startTime: (startDate ?? this.startDate)?.toUtc(),
endTime: (endDate ?? this.startDate)?.toUtc(),
startTime: startDate?.toUtc(),
endTime: endDate?.toUtc(),
device: device,
))
.toList()
Expand Down

0 comments on commit 4240ddd

Please sign in to comment.