X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Ffunction%2FRearrangePhotosFunction.java;h=b8d9312de7dce3c1c349c466ec101b8fe72c3d56;hp=7a408c04988da527ce5d8a67366cc1a2de783ea7;hb=649c5da6ee1bbc590699e11a92316ece2ea8512d;hpb=eebbb64b5d63f9eea43a0dff908c30361a376768 diff --git a/tim/prune/function/RearrangePhotosFunction.java b/tim/prune/function/RearrangePhotosFunction.java index 7a408c0..b8d9312 100644 --- a/tim/prune/function/RearrangePhotosFunction.java +++ b/tim/prune/function/RearrangePhotosFunction.java @@ -194,17 +194,21 @@ public class RearrangePhotosFunction extends GenericFunction private static void sortPhotos(DataPoint[] inPhotos, boolean inSortByFile) { Comparator comparator = null; - if (inSortByFile) { + if (inSortByFile) + { // sort by filename comparator = new Comparator() { public int compare(DataPoint inP1, DataPoint inP2) { if (inP2 == null) return -1; // all nulls at end if (inP1 == null) return 1; + if (inP1.getPhoto().getFile() == null || inP2.getPhoto().getFile() == null) + return inP1.getPhoto().getName().compareTo(inP2.getPhoto().getName()); return inP1.getPhoto().getFile().compareTo(inP2.getPhoto().getFile()); } }; } - else { + else + { // sort by photo timestamp comparator = new Comparator() { public int compare(DataPoint inP1, DataPoint inP2) {