File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,19 @@ class DBService {
11
11
}
12
12
13
13
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
+ }
24
28
}
25
29
}
You can’t perform that action at this time.
0 commit comments