Commit b4016de0 authored by Bartek Fabiszewski's avatar Bartek Fabiszewski
Browse files

Check for null location provider, fixes #29

parent 4b7290a0
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -467,6 +467,15 @@ class DbAccess {
        return cursor.getString(cursor.getColumnIndex(DbContract.Positions.COLUMN_PROVIDER));
    }

    /**
     * Check if cursor contains provider data
     * @param cursor Cursor
     * @return True if has provider data
     */
    static boolean hasProvider(Cursor cursor) {
        return !cursor.isNull(cursor.getColumnIndex(DbContract.Positions.COLUMN_PROVIDER));
    }

    /**
     * Get latitude from positions cursor
     * @param cursor Cursor
+3 −1
Original line number Diff line number Diff line
@@ -210,7 +210,9 @@ public class GpxExportService extends IntentService {
                if (DbAccess.hasBearing(cursor)) {
                    writeTag(serializer, "bearing", DbAccess.getBearing(cursor), ns_ulogger);
                }
                if (DbAccess.hasProvider(cursor)) {
                    writeTag(serializer, "provider", DbAccess.getProvider(cursor), ns_ulogger);
                }
                serializer.endTag(null, "extensions");

                serializer.endTag(null, "trkpt");
+3 −1
Original line number Diff line number Diff line
@@ -233,7 +233,9 @@ public class WebSyncService extends IntentService {
        if (DbAccess.hasAccuracy(cursor)) {
            params.put(WebHelper.PARAM_ACCURACY, DbAccess.getAccuracy(cursor));
        }
        if (DbAccess.hasProvider(cursor)) {
            params.put(WebHelper.PARAM_PROVIDER, DbAccess.getProvider(cursor));
        }
        return params;
    }