Handle null locations gracefully
This commit is contained in:
parent
a944367766
commit
f7cbd2c284
2 changed files with 8 additions and 3 deletions
|
@ -89,8 +89,12 @@ class File {
|
|||
metadata["deviceFolder"] = deviceFolder;
|
||||
metadata["creationTime"] = creationTime;
|
||||
metadata["modificationTime"] = modificationTime;
|
||||
metadata["latitude"] = location.latitude;
|
||||
metadata["longitude"] = location.longitude;
|
||||
if (location != null &&
|
||||
location.latitude != null &&
|
||||
location.longitude != null) {
|
||||
metadata["latitude"] = location.latitude;
|
||||
metadata["longitude"] = location.longitude;
|
||||
}
|
||||
metadata["fileType"] = fileType.index;
|
||||
return metadata;
|
||||
}
|
||||
|
|
|
@ -219,7 +219,8 @@ class FileUploader {
|
|||
await _putFile(thumbnailUploadURL, encryptedThumbnailFile);
|
||||
|
||||
// h4ck to fetch location data if missing (thank you Android Q+) lazily only during uploads
|
||||
if (file.location.latitude == 0 && file.location.longitude == 0) {
|
||||
if (file.location == null ||
|
||||
(file.location.latitude == 0 && file.location.longitude == 0)) {
|
||||
final latLong = await (await file.getAsset()).latlngAsync();
|
||||
file.location = Location(latLong.latitude, latLong.longitude);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue