Skip to content

Commit a4d44a7

Browse files
committed
🐛
1 parent af3381a commit a4d44a7

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

lib/services/db_service.dart

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ class DBService {
1111
}
1212

1313
getFavAnime() async {
14-
QuerySnapshot? querySnapshot;
15-
try {
16-
CollectionReference _favCollection = FirebaseFirestore.instance
17-
.collection('users')
18-
.doc(FirebaseAuth.instance.currentUser!.uid)
19-
.collection('fav');
20-
querySnapshot = await _favCollection.get();
21-
// ignore: empty_catches
22-
} catch (e) {}
23-
return querySnapshot!.docs.map((doc) => doc.data()).toList();
14+
if (FirebaseAuth.instance.currentUser != null) {
15+
QuerySnapshot? querySnapshot;
16+
try {
17+
CollectionReference _favCollection = FirebaseFirestore.instance
18+
.collection('users')
19+
.doc(FirebaseAuth.instance.currentUser!.uid)
20+
.collection('fav');
21+
querySnapshot = await _favCollection.get();
22+
// ignore: empty_catches
23+
} catch (e) {}
24+
return querySnapshot!.docs.map((doc) => doc.data()).toList();
25+
} else {
26+
return [];
27+
}
2428
}
2529
}

0 commit comments

Comments
 (0)