Fix null pointer exception
This commit is contained in:
parent
18754b6b13
commit
4342c4d138
2 changed files with 13 additions and 2 deletions
|
@ -147,7 +147,17 @@ public class GPXUtilities {
|
|||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return tracks.isEmpty() && points.isEmpty() && routes.isEmpty();
|
||||
for (Track t : tracks) {
|
||||
if (t.segments != null) {
|
||||
for (TrkSegment s : t.segments) {
|
||||
boolean tracksEmpty = s.points.isEmpty();
|
||||
if (!tracksEmpty) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return points.isEmpty() && routes.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -138,7 +138,8 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
for (final String f : data.keySet()) {
|
||||
File fout = new File(dir, f + ".gpx"); //$NON-NLS-1$
|
||||
if (!data.get(f).isEmpty()) {
|
||||
String fileName = f + "_" + new SimpleDateFormat("HH-mm_EEE").format(new Date(data.get(f).findPointToShow().time)); //$NON-NLS-1$
|
||||
WptPt pt = data.get(f).findPointToShow();
|
||||
String fileName = f + "_" + new SimpleDateFormat("HH-mm_EEE").format(new Date(pt.time)); //$NON-NLS-1$
|
||||
fout = new File(dir, fileName + ".gpx"); //$NON-NLS-1$
|
||||
int ind = 1;
|
||||
while (fout.exists()) {
|
||||
|
|
Loading…
Reference in a new issue