diff --git a/lib/components/user_tile_likes.dart b/lib/components/user_tile_likes.dart index 8050273..bf9458e 100644 --- a/lib/components/user_tile_likes.dart +++ b/lib/components/user_tile_likes.dart @@ -9,7 +9,7 @@ import '../utils/math.dart'; class UserTileLikes extends StatefulWidget { final DocumentSnapshot user; final bool hasMatch; - final UserProfile currentUser; + final UserProfile? currentUser; final VoidCallback onUnlike; final VoidCallback onShowChat; final VoidCallback onViewInfo; @@ -18,7 +18,7 @@ class UserTileLikes extends StatefulWidget { super.key, required this.user, required this.hasMatch, - required this.currentUser, + this.currentUser, required this.onUnlike, required this.onShowChat, required this.onViewInfo, @@ -58,8 +58,8 @@ class _UserTileLikesState extends State { bool hasName = userMap.containsKey(Constants.dbFieldUsersName); bool hasBio = userMap.containsKey(Constants.dbFieldUsersBio); - String? shortDist = (_otherUser != null - ? shortestDistanceBetweenUsers(widget.currentUser, _otherUser!) + String? shortDist = (_otherUser != null && widget.currentUser != null + ? shortestDistanceBetweenUsers(widget.currentUser!, _otherUser!) .toStringAsFixed(0) : null);