Fix: Empty main location bug (partially addressed in commit a2a7ae5fc6)

master
Rafael 2024-06-18 02:37:56 +02:00
parent 780d3cbbc2
commit 63bedb0280
1 changed files with 1 additions and 3 deletions

View File

@ -201,9 +201,8 @@ class _UserDataPageState extends State<UserDataPage> {
} }
// Save locations // Save locations
if (_mainLocation != _mainLocationFromDb) { if (_mainLocation == null || _mainLocation != _mainLocationFromDb) {
if (_mainLocation != null) { if (_mainLocation != null) {
// Update existing user document with new locations
await locationsRef await locationsRef
.doc(Constants.dbDocMainLocation) .doc(Constants.dbDocMainLocation)
.set(_mainLocation!.toMap()); .set(_mainLocation!.toMap());
@ -212,7 +211,6 @@ class _UserDataPageState extends State<UserDataPage> {
return false; return false;
} }
} }
if (_secondaryLocation != _secondaryLocationFromDb) { if (_secondaryLocation != _secondaryLocationFromDb) {
if (_secondaryLocation != null) { if (_secondaryLocation != null) {
await locationsRef await locationsRef